
Last chance! 50% off unlimited learning
Sale ends in
Applies a linear transformation to the incoming data: y = xA^T + b
nn_linear(in_features, out_features, bias = TRUE)
size of each input sample
size of each output sample
If set to FALSE
, the layer will not learn an additive bias.
Default: TRUE
Input: (N, *, H_in)
where *
means any number of
additional dimensions and H_in = in_features
.
Output: (N, *, H_out)
where all but the last dimension
are the same shape as the input and :math:H_out = out_features
.
weight: the learnable weights of the module of shape
(out_features, in_features)
. The values are
initialized from
bias: the learnable bias of the module of shape bias
is TRUE
, the values are initialized from
# NOT RUN {
if (torch_is_installed()) {
m <- nn_linear(20, 30)
input <- torch_randn(128, 20)
output <- m(input)
print(output$size())
}
# }
Run the code above in your browser using DataLab