Struct neuronika::nn::Linear [−][src]
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).