Skip to content

Commit bf7fe33

Browse files
committed
fixed tolerance for cholesky and reduced number of tests
1 parent 8f0e425 commit bf7fe33

File tree

3 files changed

+12
-59
lines changed

3 files changed

+12
-59
lines changed

tests/test_orthogonality_conv.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def test_dilation_strided(
249249

250250

251251
@pytest.mark.parametrize("kernel_size", [3, 4, 5])
252-
@pytest.mark.parametrize("input_channels", [2, 4, 8, 16, 32])
253-
@pytest.mark.parametrize("output_channels", [2, 4, 8, 16, 32])
252+
@pytest.mark.parametrize("input_channels", [2, 4, 32])
253+
@pytest.mark.parametrize("output_channels", [2, 4, 32])
254254
@pytest.mark.parametrize("stride", [2, 4])
255255
@pytest.mark.parametrize("groups", [1])
256256
def test_strided(kernel_size, input_channels, output_channels, stride, groups):
@@ -340,8 +340,8 @@ def test_even_kernels(kernel_size, input_channels, output_channels, stride, grou
340340

341341

342342
@pytest.mark.parametrize("kernel_size", [1, 2])
343-
@pytest.mark.parametrize("input_channels", [4, 8, 16, 32, 64])
344-
@pytest.mark.parametrize("output_channels", [4, 8, 16, 32, 64])
343+
@pytest.mark.parametrize("input_channels", [4, 8, 32])
344+
@pytest.mark.parametrize("output_channels", [4, 8, 32])
345345
@pytest.mark.parametrize("groups", [1, 2])
346346
def test_rko(kernel_size, input_channels, output_channels, groups):
347347
"""
@@ -475,19 +475,6 @@ def test_invalid_dilation_with_stride():
475475
groups=1,
476476
padding=0,
477477
)
478-
# with pytest.raises( # catched as you cannot instanciate FastBlockConv2d with co > ci & s>1
479-
# ValueError,
480-
# match=r"dilation must be 1 when stride is not 1",
481-
# ):
482-
# FastBlockConv2d(
483-
# in_channels=8,
484-
# out_channels=16,
485-
# kernel_size=3,
486-
# stride=2,
487-
# dilation=2, # Invalid: dilation > 1 while stride > 1
488-
# groups=1,
489-
# padding=0,
490-
# )
491478
with pytest.raises(
492479
ValueError,
493480
match=r"dilation must be 1 when stride is not 1",
@@ -576,6 +563,6 @@ def test_parametrizers_standard_configs(
576563
kernel_size,
577564
kernel_size,
578565
),
579-
tol=3e-2 if ortho_params.startswith("cholesky") else 1e-3,
566+
tol=5e-2 if ortho_params.startswith("cholesky") else 1e-3,
580567
sigma_min_requirement=0.75 if ortho_params.startswith("cholesky") else 0.95,
581568
)

tests/test_orthogonality_conv_transpose.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def _compute_sv_impulse_response_layer(layer, img_shape):
3535

3636

3737
@pytest.mark.parametrize("kernel_size", [1, 2, 3])
38-
@pytest.mark.parametrize("input_channels", [4, 8, 16, 32])
39-
@pytest.mark.parametrize("output_channels", [4, 8, 16, 32])
38+
@pytest.mark.parametrize("input_channels", [4, 8, 32])
39+
@pytest.mark.parametrize("output_channels", [4, 8, 32])
4040
@pytest.mark.parametrize("stride", [1, 2])
4141
@pytest.mark.parametrize("groups", [1, 2])
4242
def test_convtranspose(kernel_size, input_channels, output_channels, stride, groups):
@@ -182,40 +182,6 @@ def test_parametrizers_standard_configs(
182182
kernel_size,
183183
kernel_size,
184184
),
185-
tol=3e-2 if ortho_params.startswith("cholesky") else 1e-3,
185+
tol=5e-2 if ortho_params.startswith("cholesky") else 1e-3,
186186
sigma_min_requirement=0.75 if ortho_params.startswith("cholesky") else 0.95,
187187
)
188-
189-
# try:
190-
# orthoconvtranspose = AdaptiveOrthoConvTranspose2d(
191-
# kernel_size=kernel_size,
192-
# in_channels=input_channels,
193-
# out_channels=output_channels,
194-
# stride=stride,
195-
# groups=groups,
196-
# bias=False,
197-
# padding=(kernel_size // 2, kernel_size // 2),
198-
# # padding_mode="circular",
199-
# ortho_params=ortho_params_dict[ortho_params],
200-
# )
201-
# except Exception as e:
202-
# if kernel_size < stride:
203-
# # we expect this configuration to raise a RuntimeError
204-
# # pytest.skip(f"BCOP instantiation failed with: {e}")
205-
# return
206-
# else:
207-
# pytest.fail(f"BCOP instantiation failed with: {e}")
208-
# check_orthogonal_layer(
209-
# orthoconvtranspose,
210-
# groups,
211-
# input_channels,
212-
# kernel_size,
213-
# output_channels,
214-
# (
215-
# output_channels,
216-
# input_channels // groups,
217-
# kernel_size,
218-
# kernel_size,
219-
# ),
220-
# tol=3e-2 if ortho_params.startswith("cholesky") else 1e-4,
221-
# )

tests/test_rko.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def test_standard_configs(kernel_size, input_channels, output_channels, stride,
150150

151151

152152
@pytest.mark.parametrize("kernel_size", [3, 4, 5])
153-
@pytest.mark.parametrize("input_channels", [2, 4, 8, 16, 32])
154-
@pytest.mark.parametrize("output_channels", [2, 4, 8, 16, 32])
153+
@pytest.mark.parametrize("input_channels", [2, 4, 16])
154+
@pytest.mark.parametrize("output_channels", [2, 4, 16])
155155
@pytest.mark.parametrize("stride", [2, 4])
156156
@pytest.mark.parametrize("groups", [1])
157157
def test_strided(kernel_size, input_channels, output_channels, stride, groups):
@@ -244,8 +244,8 @@ def test_even_kernels(kernel_size, input_channels, output_channels, stride, grou
244244

245245

246246
@pytest.mark.parametrize("kernel_size", [1, 2])
247-
@pytest.mark.parametrize("input_channels", [4, 8, 16, 32, 64])
248-
@pytest.mark.parametrize("output_channels", [4, 8, 16, 32, 64])
247+
@pytest.mark.parametrize("input_channels", [4, 8, 32])
248+
@pytest.mark.parametrize("output_channels", [4, 8, 32])
249249
@pytest.mark.parametrize("groups", [1, 2])
250250
def test_rko(kernel_size, input_channels, output_channels, groups):
251251
"""

0 commit comments

Comments
 (0)