Skip to content
fn

linear_op

→TensorImplPtr
int linear_op(const int & x, const int & W, const int & b)

Python wrappers

Public Python APIs implemented by this engine symbol.

Public free-function entry point for the linear op.

Thin wrapper that delegates to LinearBackward::forward. This is the symbol the pybind11 binding layer (bind_nn.cpp) and other C++ call sites use; calling it directly is equivalent to using the node's static forward.

See Also

LinearBackward : Autograd node implementing the actual forward + backward.

Parameters

xTensorImplPtr
Input tensor of shape (∗,K)(\ast, K).
WTensorImplPtr
Weight matrix of shape (N, K).
bTensorImplPtr
Bias of shape (N,) (zero-length tensor when bias is disabled).

Returns

TensorImplPtr

Output tensor of shape (∗,N)(\ast, N).