linear(input, weight, bias=None)¶
Applies a linear transformation to the incoming data: \(y = xA^T + b\).
Input: \((N, *, in\_features)\) N is the batch size, * means any number of additional dimensions
Weight: \((out\_features, in\_features)\)
Output: \((N, *, out\_features)\)
>>> import numpy as np >>> import oneflow as flow >>> input = flow.tensor(np.random.randn(128, 20)) >>> weight = flow.tensor(np.random.randn(30, 20)) >>> output = flow.nn.functional.linear(input, weight) >>> output.size() oneflow.Size([128, 30])