nntoolbox.components.regularization module

class nntoolbox.components.regularization.DropConnect(module: torch.nn.modules.module.Module, ps: Union[List[float], float] = 0.0, weight_names: List[str] = ['weight'])[source]

Bases: torch.nn.modules.module.Module

Implementation based on fastai’s WeightDropout (from course 2 v3 notebook)

Reference:

Li Wan, Matthew Zeiler, Sixin Zhang, Yann Le Cun, Rob Fergus. “Regularization of Neural Networks using DropConnect.” http://yann.lecun.com/exdb/publis/pdf/wan-icml-13.pdf

forward(*inputs)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool