Struct juice::layers::common::linear::Linear[][src]

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

Linear Layer

Implementations

Create a Linear layer from a LinearConfig.

Trait Implementations

Since we have row vectors instead of columns, xW^T = (Wx^T)^T. Take the derivative with respect to x^T (gives us a column vector of dimension (n, 1)), we get d((Wx^T)^T)/d(x^T) = W^T of dims (n, m). In backpropagation with column vectors, we would take W^T * output_grad, and in terms of row vectors, that would be output_grad^T * W which produces a vector of dims (1, n)

Basically, x has the shape (k, n) where k is the batch size. Given W with shape (m, n) where m is output vector length, we compute the output with the formula xW^T which will give us a matrix of size (k, m) with the outputs.

Compute gradients with respect to the parameters and write them into parameters_gradients.

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Return whether weight blobs are created automatically for the layer. Read more

Adjust to shapes of the output blobs to fit the shapes of the input blobs. Read more

Returns the exact number of output blobs required by the layer, or None if no exact number is required. Read more

Initialize the layer for computation. Read more

Adjust size of shared workspace. Read more

Compute the [feedforward][1] layer output using the provided Backend. [1]: https://en.wikipedia.org/wiki/Feedforward_neural_network Read more

Compute the [backpropagation][1] input gradient using the provided backend. [1]: https://en.wikipedia.org/wiki/Backpropagation Read more

Compute the [backpropagation][1] parameters gradient using the provided backend. [1]: https://en.wikipedia.org/wiki/Backpropagation Read more

Return whether “anonymous” output blobs are created automatically for the layer. Read more

Returns the minimum number of output blobs required by the layer, or 0 if no minimum number is required. Read more

Returns the exact number of input blobs required by the layer, or None if no exact number is required. Read more

Return whether to allow force_backward for a given input blob index. Read more

Return wether a simple native backend should be used to [sync][1] instead of the default backend. [1]: #method.sync Read more

Return wether the computations of a layer should be done in-place (the output will be written where the input was read from). Read more

Return wether the layer is a container. Read more

Return the associated loss weight for a given output blob index. Read more

Return the input tensors of the layer. Read more

Return the gradients of the input tensors of the layer. Read more

Return the output tensors of the layer. Read more

Return the gradients of the output tensors of the layer. Read more

Return the learnable weights inside the layer. Read more

Return the gradients for the learnable weights inside the layer. Read more

Return the names of the learnable weights inside the layer. Read more

Return the learning rates for the learnable weights inside the layer. Read more

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

Performs the conversion.

Performs the conversion.

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.