pub struct Linear { /* private fields */ }
Expand description

Linear network layer

Represents a fully connected layer with optional bias term

The parameters are a matrix of weights of size I x N where N is the dimensionality of the output and I the dimensionality of the input

Implementations

Construct a new Linear layer

Construct a Linear layer without a bias term

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Computes a matrix product

input should have dimensions N x I where N is the number of samples and I is the dimensionality of the input

Initializes weights using Xavier initialization

weights drawn from gaussian distribution with 0 mean and variance 2/(input_size+output_size)

The gradient of the output of this layer with respect to its input
The gradient of the output of this layer with respect to its parameters
The shape of the parameters used by this layer
The number of parameters used by this layer

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.