nn.linear
Performs a linear transformation of the input tensor using the provided weights and bias.
Args
tensor
(@Tensor<T>
) - A 1D tensor representing the input tensor.weights
(@Tensor<T>
) - A 2D tensor representing the weights.bias
(@Tensor<T>
) - A 1D tensor representing the bias.
Panics
This function asserts that the input tensor
inputs
must be 1D, weights tensor must be 2D, and bias tensor must be 1D.
Returns
A Tensor<T>
representing the result of the linear transformation.
Examples
Last updated