Skip to content

Commit

Permalink
removing .keys() when iterating over dictionary keys resolving SIM118
Browse files Browse the repository at this point in the history
  • Loading branch information
hmd101 committed Oct 16, 2024
1 parent 23d5523 commit 9ae80de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_steerable_pyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def check_pyr_coeffs(coeff_1, coeff_2, rtol=1e-3, atol=1e-3):
Both coeffs must obviously have the same number of scales, orientations etc.
"""

for k in coeff_1.keys():
for k in coeff_1:
if torch.is_tensor(coeff_1[k]):
coeff_1_np = to_numpy(coeff_1[k].squeeze())
else:
Expand Down Expand Up @@ -273,7 +273,7 @@ def test_torch_vs_numpy_pyr(self, img, spyr):
torch_spc = spyr.forward(img)
# need to add 1 because our heights are 0-indexed (i.e., the lowest
# height has k[0]==0)
height = max([k[0] for k in torch_spc.keys() if isinstance(k[0], int)]) + 1
height = max([k[0] for k in torch_spc if isinstance(k[0], int)]) + 1
pyrtools_sp = pt.pyramids.SteerablePyramidFreq(
to_numpy(img.squeeze()),
height=height,
Expand Down Expand Up @@ -337,7 +337,7 @@ def test_partial_recon(self, img, spyr):
pyr_coeffs = spyr.forward(img)
# need to add 1 because our heights are 0-indexed (i.e., the lowest
# height has k[0]==0)
height = max([k[0] for k in pyr_coeffs.keys() if isinstance(k[0], int)]) + 1
height = max([k[0] for k in pyr_coeffs if isinstance(k[0], int)]) + 1
pt_spyr = pt.pyramids.SteerablePyramidFreq(
to_numpy(img.squeeze()),
height=height,
Expand Down Expand Up @@ -365,7 +365,7 @@ def test_recon_match_pyrtools(self, img, spyr, rtol=1e-6, atol=1e-6):
pyr_coeffs = spyr.forward(img)
# need to add 1 because our heights are 0-indexed (i.e., the lowest
# height has k[0]==0)
height = max([k[0] for k in pyr_coeffs.keys() if isinstance(k[0], int)]) + 1
height = max([k[0] for k in pyr_coeffs if isinstance(k[0], int)]) + 1
pt_pyr = pt.pyramids.SteerablePyramidFreq(
to_numpy(img.squeeze()),
height=height,
Expand Down

0 comments on commit 9ae80de

Please sign in to comment.