Skip to content

Commit c9b2d06

Browse files
Remove commented out code (#4187)
* Remove commented out code * [MONAI] python code formatting Signed-off-by: monai-bot <[email protected]> Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> Co-authored-by: monai-bot <[email protected]>
1 parent 5777041 commit c9b2d06

9 files changed

+0
-27
lines changed

monai/apps/deepedit/transforms.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,6 @@ def __call__(self, data):
688688
current_shape = d[self.ref_image].shape[1:]
689689
original_shape = d["image_meta_dict"]["spatial_shape"]
690690

691-
# original_shape = np.roll(original_shape, 1)
692-
693691
factor = np.divide(current_shape, original_shape)
694692
all_guidances = {}
695693
for key_label in d[self.guidance].keys():

tests/test_bending_energy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def test_ill_shape(self):
6060
loss.forward(torch.ones((1, 3), device=device))
6161
with self.assertRaisesRegex(ValueError, "Expecting 3-d, 4-d or 5-d"):
6262
loss.forward(torch.ones((1, 4, 5, 5, 5, 5), device=device))
63-
# spatial_dim < 5
6463
with self.assertRaisesRegex(ValueError, "All spatial dimensions"):
6564
loss.forward(torch.ones((1, 3, 4, 5, 5), device=device))
6665
with self.assertRaisesRegex(ValueError, "All spatial dimensions"):

tests/test_data_stats.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ class TestDataStats(unittest.TestCase):
137137
def test_value(self, input_param, input_data, expected_print):
138138
transform = DataStats(**input_param)
139139
_ = transform(input_data)
140-
# self.assertEqual(transform.output, expected_print)
141140

142141
@parameterized.expand([TEST_CASE_8])
143142
def test_file(self, input_data, expected_print):

tests/test_data_statsd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ class TestDataStatsd(unittest.TestCase):
161161
def test_value(self, input_param, input_data, expected_print):
162162
transform = DataStatsd(**input_param)
163163
_ = transform(input_data)
164-
# self.assertEqual(transform.printer.output, expected_print)
165164

166165
@parameterized.expand([TEST_CASE_9])
167166
def test_file(self, input_data, expected_print):

tests/test_focal_loss.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@ def test_consistency_with_cross_entropy_2d_no_reduction(self):
6767
b = output1.cpu().detach().numpy()
6868
error = np.abs(a - b)
6969
max_error = np.maximum(error, max_error)
70-
# if np.all(np.abs(a - b) > max_error):
71-
# max_error = np.abs(a - b)
7270

7371
assert np.allclose(max_error, 0)
74-
# self.assertAlmostEqual(max_error, 0.0, places=3)
7572

7673
def test_consistency_with_cross_entropy_2d_onehot_label(self):
7774
"""For gamma=0 the focal loss reduces to the cross entropy loss"""

tests/test_fourier.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
from tests.utils import SkipIfBeforePyTorchVersion, SkipIfNoModule
2222

2323
TEST_CASES = [((128, 64),), ((64, 48, 80),)]
24-
# for shape in ((128, 64), (64, 48, 80)):
25-
# TEST_CASES.append(shape)
2624

2725

2826
@SkipIfBeforePyTorchVersion((1, 8))

tests/test_print_transform_backends.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ def test_get_number_of_conversions(self):
2222

2323

2424
if __name__ == "__main__":
25-
# unittest.main()
2625
a = TestPrintTransformBackends()
2726
a.test_get_number_of_conversions()

tests/test_rand_cucim_dict_transform.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,10 @@ class TestRandCuCIMDict(unittest.TestCase):
9191
)
9292
def test_tramsforms_numpy_single(self, params, input, expected):
9393
input = {"image": np.copy(input)}
94-
# apply_prob=1.0
9594
output = RandCuCIMd(keys="image", apply_prob=1.0, **params)(input)["image"]
9695
self.assertTrue(output.dtype == expected.dtype)
9796
self.assertTrue(isinstance(output, np.ndarray))
9897
cp.testing.assert_allclose(output, expected)
99-
# apply_prob=0.0
10098
output = RandCuCIMd(keys="image", apply_prob=0.0, **params)(input)["image"]
10199
self.assertTrue(output.dtype == input["image"].dtype)
102100
self.assertTrue(isinstance(output, np.ndarray))
@@ -117,12 +115,10 @@ def test_tramsforms_numpy_single(self, params, input, expected):
117115
def test_tramsforms_numpy_batch(self, params, input, expected):
118116
input = {"image": np.copy(input[cp.newaxis, ...])}
119117
expected = expected[cp.newaxis, ...]
120-
# apply_prob=1.0
121118
output = RandCuCIMd(keys="image", apply_prob=1.0, **params)(input)["image"]
122119
self.assertTrue(output.dtype == expected.dtype)
123120
self.assertTrue(isinstance(output, np.ndarray))
124121
cp.testing.assert_allclose(output, expected)
125-
# apply_prob=0.0
126122
output = RandCuCIMd(keys="image", apply_prob=0.0, **params)(input)["image"]
127123
self.assertTrue(output.dtype == input["image"].dtype)
128124
self.assertTrue(isinstance(output, np.ndarray))
@@ -143,12 +139,10 @@ def test_tramsforms_numpy_batch(self, params, input, expected):
143139
def test_tramsforms_cupy_single(self, params, input, expected):
144140
input = {"image": cp.asarray(input)}
145141
expected = cp.asarray(expected)
146-
# apply_prob=1.0
147142
output = RandCuCIMd(keys="image", apply_prob=1.0, **params)(input)["image"]
148143
self.assertTrue(output.dtype == expected.dtype)
149144
self.assertTrue(isinstance(output, cp.ndarray))
150145
cp.testing.assert_allclose(output, expected)
151-
# apply_prob=0.0
152146
output = RandCuCIMd(keys="image", apply_prob=0.0, **params)(input)["image"]
153147
self.assertTrue(output.dtype == input["image"].dtype)
154148
self.assertTrue(isinstance(output, cp.ndarray))
@@ -169,12 +163,10 @@ def test_tramsforms_cupy_single(self, params, input, expected):
169163
def test_tramsforms_cupy_batch(self, params, input, expected):
170164
input = {"image": cp.asarray(input)[cp.newaxis, ...]}
171165
expected = cp.asarray(expected)[cp.newaxis, ...]
172-
# apply_prob=1.0
173166
output = RandCuCIMd(keys="image", **params)(input)["image"]
174167
self.assertTrue(output.dtype == expected.dtype)
175168
self.assertTrue(isinstance(output, cp.ndarray))
176169
cp.testing.assert_allclose(output, expected)
177-
# apply_prob=0.0
178170
output = RandCuCIMd(keys="image", apply_prob=0.0, **params)(input)["image"]
179171
self.assertTrue(output.dtype == input["image"].dtype)
180172
self.assertTrue(isinstance(output, cp.ndarray))

tests/test_rand_cucim_transform.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,11 @@ class TestRandCuCIM(unittest.TestCase):
9090
]
9191
)
9292
def test_tramsforms_numpy_single(self, params, input, expected):
93-
# apply_prob=1.0
9493
input = np.copy(input)
9594
output = RandCuCIM(apply_prob=1.0, **params)(input)
9695
self.assertTrue(output.dtype == expected.dtype)
9796
self.assertTrue(isinstance(output, np.ndarray))
9897
cp.testing.assert_allclose(output, expected)
99-
# apply_prob=0.0
10098
output = RandCuCIM(apply_prob=0.0, **params)(input)
10199
self.assertTrue(output.dtype == input.dtype)
102100
self.assertTrue(isinstance(output, np.ndarray))
@@ -117,12 +115,10 @@ def test_tramsforms_numpy_single(self, params, input, expected):
117115
def test_tramsforms_numpy_batch(self, params, input, expected):
118116
input = np.copy(input[cp.newaxis, ...])
119117
expected = expected[cp.newaxis, ...]
120-
# apply_prob=1.0
121118
output = RandCuCIM(apply_prob=1.0, **params)(input)
122119
self.assertTrue(output.dtype == expected.dtype)
123120
self.assertTrue(isinstance(output, np.ndarray))
124121
cp.testing.assert_allclose(output, expected)
125-
# apply_prob=0.0
126122
output = RandCuCIM(apply_prob=0.0, **params)(input)
127123
self.assertTrue(output.dtype == input.dtype)
128124
self.assertTrue(isinstance(output, np.ndarray))
@@ -143,12 +139,10 @@ def test_tramsforms_numpy_batch(self, params, input, expected):
143139
def test_tramsforms_cupy_single(self, params, input, expected):
144140
input = cp.asarray(input)
145141
expected = cp.asarray(expected)
146-
# apply_prob=1.0
147142
output = RandCuCIM(apply_prob=1.0, **params)(input)
148143
self.assertTrue(output.dtype == expected.dtype)
149144
self.assertTrue(isinstance(output, cp.ndarray))
150145
cp.testing.assert_allclose(output, expected)
151-
# apply_prob=0.0
152146
output = RandCuCIM(apply_prob=0.0, **params)(input)
153147
self.assertTrue(output.dtype == input.dtype)
154148
self.assertTrue(isinstance(output, cp.ndarray))
@@ -169,12 +163,10 @@ def test_tramsforms_cupy_single(self, params, input, expected):
169163
def test_tramsforms_cupy_batch(self, params, input, expected):
170164
input = cp.asarray(input)[cp.newaxis, ...]
171165
expected = cp.asarray(expected)[cp.newaxis, ...]
172-
# apply_prob=1.0
173166
output = RandCuCIM(**params)(input)
174167
self.assertTrue(output.dtype == expected.dtype)
175168
self.assertTrue(isinstance(output, cp.ndarray))
176169
cp.testing.assert_allclose(output, expected)
177-
# apply_prob=0.0
178170
output = RandCuCIM(apply_prob=0.0, **params)(input)
179171
self.assertTrue(output.dtype == input.dtype)
180172
self.assertTrue(isinstance(output, cp.ndarray))

0 commit comments

Comments
 (0)