nn_linear {torch}R Documentation

Linear module

Description

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

Usage

nn_linear(in_features, out_features, bias = TRUE)

Arguments

in_features

size of each input sample

out_features

size of each output sample

bias

If set to FALSE, the layer will not learn an additive bias. Default: TRUE

Shape

Attributes

Examples

if (torch_is_installed()) {
m <- nn_linear(20, 30)
input <- torch_randn(128, 20)
output <- m(input)
print(output$size())
}

[Package torch version 0.12.0 Index]