Skip to content

Commit 8e8ed2e

Browse files
MMelQinCopilot
andauthored
Update monai/deploy/operators/monai_seg_inference_operator.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Ming M Qin <38891913+MMelQin@users.noreply.github.com>
1 parent 8f659b2 commit 8e8ed2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

monai/deploy/operators/monai_seg_inference_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def _copy_compatible_dict(from_dict: Dict, to_dict: Dict):
606606
datum = from_dict[key]
607607
if isinstance(datum, np.ndarray) and np_str_obj_array_pattern.search(datum.dtype.str) is not None:
608608
continue
609-
to_dict[key] = str(TraceKeys.NONE) if datum is None else datum # NoneType to string for default_collate
609+
to_dict[key] = str(TraceKeys.NONE) if datum is None else datum # Convert NoneType to string to prevent issues with PyTorch's default_collate, which cannot handle None values directly
610610
else:
611611
affine_key, shape_key = MetaKeys.AFFINE, MetaKeys.SPATIAL_SHAPE
612612
if affine_key in from_dict and not np.allclose(from_dict[affine_key], to_dict[affine_key]):

0 commit comments

Comments
 (0)