Skip to content

Commit

Permalink
Update test_nacl_loss.py
Browse files Browse the repository at this point in the history
Introduce temporary value for same cases to reduce space. 

DCO Remediation Commit for bala93 <balamuralim.1993@gmail.com>

I, bala93 <balamuralim.1993@gmail.com>, hereby add my Signed-off-by to this commit: 8fbec82
I, bala93 <balamuralim.1993@gmail.com>, hereby add my Signed-off-by to this commit: 7c121a0
I, bala93 <balamuralim.1993@gmail.com>, hereby add my Signed-off-by to this commit: dccde47

Signed-off-by: bala93 <balamuralim.1993@gmail.com>
  • Loading branch information
Bala93 authored Aug 5, 2024
1 parent 4462379 commit c4f8283
Showing 1 changed file with 12 additions and 32 deletions.
44 changes: 12 additions & 32 deletions tests/test_nacl_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@

from monai.losses import NACLLoss

TEST_CASES = [
[
{"classes": 3, "dim": 2},
{
"inputs": torch.tensor(
inputs = torch.tensor(
[
[
[
Expand All @@ -46,39 +42,23 @@
],
]
]
),
"targets": torch.tensor([[[1, 1, 1, 1], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]]),
)
targets = torch.tensor([[[1, 1, 1, 1], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]]),

TEST_CASES = [
[
{"classes": 3, "dim": 2},
{
"inputs": inputs,
"targets": targets,
},
1.1820,
],
[
{"classes": 3, "dim": 2, "kernel_ops": "gaussian"},
{
"inputs": torch.tensor(
[
[
[
[0.1498, 0.1158, 0.3996, 0.3730],
[0.2155, 0.1585, 0.8541, 0.8579],
[0.6640, 0.2424, 0.0774, 0.0324],
[0.0580, 0.2180, 0.3447, 0.8722],
],
[
[0.3908, 0.9366, 0.1779, 0.1003],
[0.9630, 0.6118, 0.4405, 0.7916],
[0.5782, 0.9515, 0.4088, 0.3946],
[0.7860, 0.3910, 0.0324, 0.9568],
],
[
[0.0759, 0.0238, 0.5570, 0.1691],
[0.2703, 0.7722, 0.1611, 0.6431],
[0.8051, 0.6596, 0.4121, 0.1125],
[0.5283, 0.6746, 0.5528, 0.7913],
],
]
]
),
"targets": torch.tensor([[[1, 1, 1, 1], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]]),
"inputs": inputs,
"targets": targets,
},
1.1850,
],
Expand Down

0 comments on commit c4f8283

Please sign in to comment.