Skip to content

Commit 3c58135

Browse files
advcu987ericspod
andauthored
Update monai/transforms/intensity/array.py
Thanks eric for the suggestion Co-authored-by: Eric Kerfoot <[email protected]> Signed-off-by: advcu <[email protected]>
1 parent 3656b99 commit 3c58135

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

monai/transforms/intensity/array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,8 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
907907
if self.divisor is not None and len(self.divisor) != len(img):
908908
raise ValueError(f"img has {len(img)} channels, but divisor has {len(self.divisor)} components.")
909909

910-
img, *_ = convert_data_type(img, dtype=torch.float32)
910+
if not img.dtype.is_floating_point:
911+
img, *_ = convert_data_type(img, dtype=torch.float32)
911912

912913
for i, d in enumerate(img):
913914
img[i] = self._normalize( # type: ignore

0 commit comments

Comments
 (0)