Skip to content

Commit

Permalink
Add TupleSelect layer
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuele Ballarin <[email protected]>
  • Loading branch information
emaballarin committed Jul 20, 2024
1 parent 9794250 commit 80d78d6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions ebtorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
del SolvePoissonTensor
del SwiGLU
del TupleDecouple
del TupleSelect
del SilhouetteScore
del Concatenate
del DuplexLinearNeck
Expand Down
1 change: 1 addition & 0 deletions ebtorch/nn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from .architectures import SirenSine
from .architectures import SwiGLU
from .architectures import TupleDecouple
from .architectures import TupleSelect
from .architectures_resnets_dm import PreActResNet
from .architectures_resnets_dm import WideResNet
from .convolutional_flatten import ConvolutionalFlattenLayer
Expand Down
10 changes: 10 additions & 0 deletions ebtorch/nn/architectures.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"Clamp",
"SwiGLU",
"TupleDecouple",
"TupleSelect",
"SilhouetteScore",
"Concatenate",
"DuplexLinearNeck",
Expand Down Expand Up @@ -907,6 +908,15 @@ def forward(self, xtuple: Tuple[Tensor, ...]) -> Tuple[Tensor, ...]:
)


class TupleSelect(nn.Module):
def __init__(self, idx: int = 0) -> None:
super().__init__()
self.idx: int = idx

def forward(self, xtuple: Tuple[Tensor, ...]) -> Tensor:
return xtuple[self.idx]


class SilhouetteScore(nn.Module):
"""
Layerized computation of the Silhouette Score.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def read(fname):

setup(
name=PACKAGENAME,
version="0.25.11",
version="0.25.12",
author="Emanuele Ballarin",
author_email="[email protected]",
url="https://github.com/emaballarin/ebtorch",
Expand Down

0 comments on commit 80d78d6

Please sign in to comment.