Skip to content

Commit

Permalink
remove same case for padding_mode to solve #23 (comment) and #23 (com…
Browse files Browse the repository at this point in the history
  • Loading branch information
franckma31 committed Dec 10, 2024
1 parent a8721bb commit a0a81da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion deel/torchlip/modules/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,3 @@ def forward(self, input: torch.Tensor) -> torch.Tensor:

def vanilla_export(self):
return self

12 changes: 2 additions & 10 deletions deel/torchlip/utils/lconv_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ def compute_lconv_coef_1d(
stride = strides[0]
k1 = kernel_size[0]

if (
(padding_mode in ["zeros", "same"])
and (stride == 1)
and (input_shape is not None)
):
if (padding_mode in ["zeros"]) and (stride == 1) and (input_shape is not None):
# See https://arxiv.org/abs/2006.06520
in_l = input_shape[-1]
k1_div2 = (k1 - 1) / 2
Expand All @@ -67,11 +63,7 @@ def compute_lconv_coef(
stride = np.prod(strides)
k1, k2 = kernel_size

if (
(padding_mode in ["zeros", "same"])
and (stride == 1)
and (input_shape is not None)
):
if (padding_mode in ["zeros"]) and (stride == 1) and (input_shape is not None):
h, w = input_shape[-2:]
k1_div2 = (k1 - 1) / 2
k2_div2 = (k2 - 1) / 2
Expand Down

0 comments on commit a0a81da

Please sign in to comment.