MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / randomize

Method randomize

monai/transforms/regularization/array.py:50–62  ·  view source on GitHub ↗

Sometimes you need may to apply the same transform to different tensors. The idea is to get a sample and then apply it with apply() as often as needed. You need to call this method everytime you apply the transform to a new batch.

(self, data=None)

Source from the content-addressed store, hash-verified

48 raise NotImplementedError()
49
50 def randomize(self, data=None) -> None:
51 """
52 Sometimes you need may to apply the same transform to different tensors.
53 The idea is to get a sample and then apply it with apply() as often
54 as needed. You need to call this method everytime you apply the transform to a new
55 batch.
56 """
57 super().randomize(None)
58 self._params = (
59 torch.from_numpy(self.R.beta(self.alpha, self.alpha, self.batch_size)).type(torch.float32),
60 self.R.permutation(self.batch_size),
61 [torch.from_numpy(self.R.randint(0, d, size=(1,))) for d in data.shape[2:]] if data is not None else [],
62 )
63
64
65class MixUp(Mixer):

Callers 6

__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected