MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / reset_ops_id

Function reset_ops_id

monai/transforms/utils.py:1805–1817  ·  view source on GitHub ↗

find MetaTensors in list or dict `data` and (in-place) set ``TraceKeys.ID`` to ``Tracekeys.NONE``.

(data)

Source from the content-addressed store, hash-verified

1803
1804
1805def reset_ops_id(data):
1806 """find MetaTensors in list or dict `data` and (in-place) set ``TraceKeys.ID`` to ``Tracekeys.NONE``."""
1807 if isinstance(data, (list, tuple)):
1808 return [reset_ops_id(d) for d in data]
1809 if isinstance(data, monai.data.MetaTensor):
1810 data.applied_operations = reset_ops_id(data.applied_operations)
1811 return data
1812 if not isinstance(data, Mapping):
1813 return data
1814 data = dict(data)
1815 if TraceKeys.ID in data:
1816 data[TraceKeys.ID] = TraceKeys.NONE
1817 return {k: reset_ops_id(v) for k, v in data.items()}
1818
1819
1820def compute_divisible_spatial_size(spatial_shape: Sequence[int], k: Sequence[int] | int):

Callers 4

_pre_transformMethod · 0.90
_pre_transformMethod · 0.90
test_transformsMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_transformsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…