Module dfdx::nn

source · []
Expand description

High level neural network building blocks such as Linear, activations, and tuples as Modules. Also includes .save() & .load() for all Modules.

Saving and loading model parameters is done using SaveToNpz and LoadFromNpz. All modules provided here implement it, including tuples. So you can call SaveToNpz::save() to save the module to a .npz zip file format, and then LoadFromNpz::load() to load the weights.

Randomizing parameters is done using ResetParams::reset_params(). All modules implement the underlying logic themselves. For example Linear calculates the distribution it draws values from based on its input size.

Structs

Unit struct that impls Module as calling abs() on input.

Unit struct that impls Module as calling cos() on input.

A Module that calls dropout() in Module::forward() with probability self.p.

A Module that calls dropout() in Module::forward() with probability 1.0 / N. Note that dropout() does not do anything for tensors with NoTape.

Unit struct that impls Module as calling exp() on input.

Implements layer normalization as described in Layer Normalization.

A linear transformation of the form x * transpose(W) + b, where W is a matrix, x is a vector or matrix, and b is a vector. If x is a matrix this does matrix multiplication.

Unit struct that impls Module as calling ln() on input.

Unit struct that impls Module as calling relu() on input.

Repeats T N times. This requires that T’s input is the same as it’s output.

Represents a residual connection around F: F(x) + x, as introduced in Deep Residual Learning for Image Recognition.

Unit struct that impls Module as calling sigmoid() on input.

Unit struct that impls Module as calling sin() on input.

Unit struct that impls Module as calling sqrt() on input.

Unit struct that impls Module as calling square() on input.

Unit struct that impls Module as calling tanh() on input.

Enums

Error that can happen while loading data from a .npz zip archive.

Traits

Something that can be loaded from a .npz file (which is a zip file).

A unit of a neural network. Acts on the generic Input and produces Module::Output.

Something that can be saved to a .npz (which is a .zip).

Functions

Reads data from a file already in a zip archive named filename.

Writes data to a new file in a zip archive named filename.