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

Class _StatefulTransform

tests/data/test_cachedataset.py:109–120  ·  view source on GitHub ↗

A transform with an internal state. The state is changing at each call.

Source from the content-addressed store, hash-verified

107
108
109class _StatefulTransform(Transform, ThreadUnsafe):
110 """
111 A transform with an internal state.
112 The state is changing at each call.
113 """
114
115 def __init__(self):
116 self.property = 1
117
118 def __call__(self, data):
119 self.property = self.property + 1
120 return data * 100 + self.property
121
122
123class TestCacheThread(unittest.TestCase):

Callers 1

test_thread_safeMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_thread_safeMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…