Skip to content

Commit 05720c6

Browse files
committed
Correct CoPilot suggested code which failed liniting
Signed-off-by: M Q <mingmelvinq@nvidia.com>
1 parent 8e8ed2e commit 05720c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

monai/deploy/operators/monai_seg_inference_operator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,9 @@ 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 # Convert NoneType to string to prevent issues with PyTorch's default_collate, which cannot handle None values directly
609+
to_dict[key] = (
610+
str(TraceKeys.NONE) if datum is None else datum
611+
) # PyTorch's default_collate cannot handle None values directly
610612
else:
611613
affine_key, shape_key = MetaKeys.AFFINE, MetaKeys.SPATIAL_SHAPE
612614
if affine_key in from_dict and not np.allclose(from_dict[affine_key], to_dict[affine_key]):

0 commit comments

Comments
 (0)