From c0daf6f7ea63ecbe7a9a5bdecf7f823d3fef71fb Mon Sep 17 00:00:00 2001 From: YunLiu <55491388+KumoLiu@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:10:14 +0800 Subject: [PATCH] fix #8186 Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> --- monai/transforms/transform.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/monai/transforms/transform.py b/monai/transforms/transform.py index afd6bf9f84..696586c0f6 100644 --- a/monai/transforms/transform.py +++ b/monai/transforms/transform.py @@ -136,9 +136,7 @@ def apply_transform( Union[List[ReturnType], ReturnType]: The return type of `transform` or a list thereof. """ try: - if not map_items: - return _apply_transform(transform, data, unpack_items, lazy, overrides, log_stats) - if isinstance(data, (list, tuple)): + if isinstance(data, (list, tuple)) and map_items: return [apply_transform(transform, item, map_items, unpack_items, log_stats, lazy, overrides) for item in data] return _apply_transform(transform, data, unpack_items, lazy, overrides, log_stats) except Exception as e: