struct
SushiAI::NN::Linear
Represents an affine transformation: Y = X * W^T + b.
- Declared in
include/SushiAI/nn/layers.hpp
Public attributes
int64_t in_features = 0Input features per sample.
int64_t out_features = 0Output features per sample.
bool use_bias = trueWhether to add a learnable bias.
Parameter weight {}The [out_features, in_features] weight.
Parameter bias {}The [out_features] bias; undeclared when use_bias is false.
Static public member functions
static constexpr auto fields()This layer's parameters, for the generic walk.
Public member functions
Graph::ValueId forward(const Graph::GraphBuilder &builder, Graph::ValueId x)Traces the layer, declaring its parameters on first call.
Parameters
builderWhere the nodes go.
xAn [N, in_features] input.
Returns
The [N, out_features] result's id.
Exceptions
ErrorIf
x'sinner extent is not in_features.
Shape output_shape(const Shape &input) constReturns the per-sample shape forward() produces, [out_features].
Parameters
inputThe per-sample input shape; must be [in_features].

