example.fashionMNIST.models package
Submodules
example.fashionMNIST.models.FullyConnected module
- class FullyConnected(input_size, num_classes)
Definition of a simple fully connected classification model.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)
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.
- class FullyConnectedRegularized(input_size, num_classes, l2_reg)
Definition simple fully connected classification model with network regularization.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)
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.
- penalty()
- build_model(model_name)
Build the right model in function of the given name.
- Parameters:
model_name (str.) – Name of the model used inside the calling context.
- Returns:
The matching model.
- Return type:
nn.Module.
- linear_relu(dim_in, dim_out)
Create a linear reLU layer.
- Parameters:
dim_in (int) – Input dimension of the layer.
dim_out (int) – Output dimension of the layer.
- Returns:
A linear reLU layer.
- Return type:
nn.Linear.