holocron.utils.data¶
Batch collate¶
- holocron.utils.data.mixup_collate(data: List[Tuple[Tensor, int]], alpha: float = 0.1) Tuple[Tensor, Tensor, Tensor, float] [source]¶
Implements a batch collate function with MixUp strategy from “mixup: Beyond Empirical Risk Minimization”
- Parameters:
data – list of elements
alpha – mixup factor
- Returns:
interpolated input original target resorted target interpolation factor
- Example::
>>> import torch >>> from holocron import utils >>> loader = torch.utils.data.DataLoader(dataset, batch_size, collate_fn=utils.data.mixup_collate)