Skip to content

Commit e8e1440

Browse files
BUG: Fix traceback in restored transform (#1766)
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]>
1 parent 73ea0c7 commit e8e1440

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

monailabel/transform/post.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __call__(self, data):
129129
spatial_size = spatial_shape[-len(current_size) :]
130130

131131
# Undo Spacing
132-
if np.any(np.not_equal(current_size, spatial_size)):
132+
if torch.any(torch.Tensor(np.not_equal(current_size, spatial_size))):
133133
resizer = Resize(spatial_size=spatial_size, mode=self.mode[idx])
134134
result = resizer(result, mode=self.mode[idx], align_corners=self.align_corners[idx])
135135

0 commit comments

Comments
 (0)