Skip to content

Commit 9fb918d

Browse files
committed
fix numpy decollate multi arrays
Signed-off-by: Arthur Dujardin <arthurdujardin.dev@gmail.com>
1 parent ed1e563 commit 9fb918d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

monai/data/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,10 @@ def decollate_batch(batch, detach: bool = True, pad=True, fill_value=None):
647647
if isinstance(batch, np.ndarray):
648648
if batch.ndim == 0:
649649
return batch.item()
650-
out_list = np.split(batch, batch.shape[0], axis=0) # type: ignore[assignment]
650+
out_list = list(batch)
651651
if out_list[0].ndim == 0 and detach:
652652
return [t.item() for t in out_list]
653-
return list(out_list)
653+
return out_list
654654

655655
b, non_iterable, deco = _non_zipping_check(batch, detach, pad, fill_value)
656656
if b <= 0: # all non-iterable, single item "batch"? {"image": 1, "label": 1}

0 commit comments

Comments
 (0)