nntoolbox.callbacks.mixup module¶
-
class
nntoolbox.callbacks.mixup.ManifoldMixupCallback(learner, modules: Sequence[nntoolbox.callbacks.mixup.ManifoldMixupModule], alpha: float = 2.0)[source]¶ Bases:
nntoolbox.callbacks.callbacks.CallbackImplement manifold mixup regularization as a callback. Each iteration, pick a random layer and transform its output and label: x = tau x_1 + (1 - tau) x_2 y = tau y_1 + (1 - tau) y_2 Reference: https://arxiv.org/pdf/1806.05236.pdf Based on fastai implementation: https://github.com/fastai/fastai/blob/master/fastai/callbacks/mixup.py
-
class
nntoolbox.callbacks.mixup.ManifoldMixupModule(base_module: torch.nn.modules.module.Module)[source]¶ Bases:
torch.nn.modules.module.ModuleWrapper module to apply manifold mixup
-
forward(input)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
training: bool¶
-