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

Method __call__

monai/transforms/regularization/array.py:155–166  ·  view source on GitHub ↗
(self, data: torch.Tensor, labels: torch.Tensor | None = None, randomize=True)

Source from the content-addressed store, hash-verified

153 return mixweight * labels + (1 - mixweight) * labels[perm, ...]
154
155 def __call__(self, data: torch.Tensor, labels: torch.Tensor | None = None, randomize=True):
156 data_t = convert_to_tensor(data, track_meta=get_track_meta())
157 augmented_label = None
158 if labels is not None:
159 labels_t = convert_to_tensor(labels, track_meta=get_track_meta())
160 if randomize:
161 self.randomize(data)
162 augmented = convert_to_dst_type(self.apply(data_t), dst=data)[0]
163
164 if labels is not None:
165 augmented_label = convert_to_dst_type(self.apply(labels_t), dst=labels)[0]
166 return (augmented, augmented_label) if labels is not None else augmented
167
168
169class CutOut(Mixer):

Callers

nothing calls this directly

Calls 5

applyMethod · 0.95
convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
convert_to_dst_typeFunction · 0.90
randomizeMethod · 0.45

Tested by

no test coverage detected