Skip to content

Commit

Permalink
BUG: Fix traceback in restored transform (#1766)
Browse files Browse the repository at this point in the history
Using transforms from MONAI and MONAILabel can result in metadata containing torch.tensors and torch.Sizes. This change fixes a traceback in the restored transform resulting from an incompatibility between torch datatypes and numpy.any().
Signed-off-by: Thomas Kierski <[email protected]>
  • Loading branch information
ThomasKierski authored Oct 26, 2024
1 parent 73ea0c7 commit e8e1440
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monailabel/transform/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __call__(self, data):
spatial_size = spatial_shape[-len(current_size) :]

# Undo Spacing
if np.any(np.not_equal(current_size, spatial_size)):
if torch.any(torch.Tensor(np.not_equal(current_size, spatial_size))):
resizer = Resize(spatial_size=spatial_size, mode=self.mode[idx])
result = resizer(result, mode=self.mode[idx], align_corners=self.align_corners[idx])

Expand Down

0 comments on commit e8e1440

Please sign in to comment.