cerebras.modelzoo.data.vision.classification.mixup.RandomCutmix#
- class cerebras.modelzoo.data.vision.classification.mixup.RandomCutmix[source]#
Bases:
torch.nn.Module
Randomly apply Cutmix to the provided batch and targets. The class implements the data augmentations as described in the paper “CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features”. :param num_classes: number of classes used for one-hot encoding. :type num_classes: int :param p: probability of the batch being transformed. Default value is 0.5. :type p: float :param alpha: hyperparameter of the Beta distribution used for cutmix.
Default value is 1.0.
- Parameters
inplace (bool) – boolean to make this transform inplace. Default set to False.
Methods
- param batch
Float tensor of size (B, C, H, W)
- forward(batch, target)[source]#
- Parameters
batch (Tensor) – Float tensor of size (B, C, H, W)
target (Tensor) – Integer tensor of size (B, )
- Returns
Randomly transformed batch.
- Return type
Tensor
- __call__(*args: Any, **kwargs: Any) Any #
Call self as a function.
- static __new__(cls, *args: Any, **kwargs: Any) Any #