Skip to content

Commit bc6b995

Browse files
authored
Update test_nacl_loss.py
DCO Remediation Commit for bala93 <[email protected]> I, Balamurali <[email protected]>, hereby add my Signed-off-by to this commit: c4f8283 I, bala93 <[email protected]>, hereby add my Signed-off-by to this commit: 8fbec82 I, bala93 <[email protected]>, hereby add my Signed-off-by to this commit: 7c121a0 I, bala93 <[email protected]>, hereby add my Signed-off-by to this commit: dccde47 Signed-off-by: bala93 <[email protected]>
1 parent c4f8283 commit bc6b995

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

tests/test_nacl_loss.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@
2020
from monai.losses import NACLLoss
2121

2222
inputs = torch.tensor(
23-
[
24-
[
25-
[
26-
[0.1498, 0.1158, 0.3996, 0.3730],
27-
[0.2155, 0.1585, 0.8541, 0.8579],
28-
[0.6640, 0.2424, 0.0774, 0.0324],
29-
[0.0580, 0.2180, 0.3447, 0.8722],
30-
],
31-
[
32-
[0.3908, 0.9366, 0.1779, 0.1003],
33-
[0.9630, 0.6118, 0.4405, 0.7916],
34-
[0.5782, 0.9515, 0.4088, 0.3946],
35-
[0.7860, 0.3910, 0.0324, 0.9568],
36-
],
37-
[
38-
[0.0759, 0.0238, 0.5570, 0.1691],
39-
[0.2703, 0.7722, 0.1611, 0.6431],
40-
[0.8051, 0.6596, 0.4121, 0.1125],
41-
[0.5283, 0.6746, 0.5528, 0.7913],
42-
],
43-
]
44-
]
45-
)
46-
targets = torch.tensor([[[1, 1, 1, 1], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]]),
23+
[
24+
[
25+
[
26+
[0.1498, 0.1158, 0.3996, 0.3730],
27+
[0.2155, 0.1585, 0.8541, 0.8579],
28+
[0.6640, 0.2424, 0.0774, 0.0324],
29+
[0.0580, 0.2180, 0.3447, 0.8722],
30+
],
31+
[
32+
[0.3908, 0.9366, 0.1779, 0.1003],
33+
[0.9630, 0.6118, 0.4405, 0.7916],
34+
[0.5782, 0.9515, 0.4088, 0.3946],
35+
[0.7860, 0.3910, 0.0324, 0.9568],
36+
],
37+
[
38+
[0.0759, 0.0238, 0.5570, 0.1691],
39+
[0.2703, 0.7722, 0.1611, 0.6431],
40+
[0.8051, 0.6596, 0.4121, 0.1125],
41+
[0.5283, 0.6746, 0.5528, 0.7913],
42+
],
43+
]
44+
]
45+
)
46+
targets = (torch.tensor([[[1, 1, 1, 1], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]]),)
4747

4848
TEST_CASES = [
4949
[
@@ -170,7 +170,9 @@ class TestNACLLoss(unittest.TestCase):
170170
def test_result(self, input_param, input_data, expected_val):
171171
loss = NACLLoss(**input_param)
172172
result = loss(**input_data)
173-
np.testing.assert_allclose(result.detach().cpu().numpy(), expected_val, atol=1e-4, rtol=1e-4)
173+
np.testing.assert_allclose(
174+
result.detach().cpu().numpy(), expected_val, atol=1e-4, rtol=1e-4
175+
)
174176

175177

176178
if __name__ == "__main__":

0 commit comments

Comments
 (0)