logo

Struct neuronika::nn::Linear[][src]

pub struct Linear {
    pub weight: Learnable<Ix2>,
    pub bias: Learnable<Ix1>,
}
Expand description

Applies a linear transformation to the incoming data.

ʏ = xAᵀ + b

Fields

weight: Learnable<Ix2>bias: Learnable<Ix1>

Implementations

Creates a linear layer.

Arguments
  • in_features – size of each input sample.

  • out_features – size of each output sample.

The learnable weight of the layer is of shape (out_features, in_features). The learnable bias of the layer is of shape out_features.

The values for both the weight and bias are initialized from U(-k, k) where k = (1. / in_features as f32).sqrt().

Applies the linear transformation y = xA^T + b to the incoming data.

Arguments

data - a variable of shape (N, in_features), the output’s shape will be (N, out_features).

Trait Implementations

Registers the weight and the bias of this Linear instance.

Register self’s status to the model’s status state status.

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. 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.