Skip to content

Commit 650ead3

Browse files
committed
core: assert isinstance linear if strict_layer_type is True
1 parent b70a882 commit 650ead3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

topoloss/core.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ def get_layerwise_topo_losses(self, model, do_scaling: bool = True) -> dict:
6969
)
7070

7171
elif isinstance(loss_info, LaplacianPyramidOnInput):
72-
assert isinstance(
73-
layer, nn.Linear
74-
), f"Expected layer to be nn.Linear, but got: {type(layer)}"
72+
if self.strict_layer_type is True:
73+
assert isinstance(
74+
layer, nn.Linear
75+
), f"Expected layer to be nn.Linear, but got: {type(layer)}"
7576
cortical_sheet = get_cortical_sheet_linear_input(layer=layer)
7677
loss = laplacian_pyramid_loss(
7778
cortical_sheet=cortical_sheet,

0 commit comments

Comments
 (0)