Contents

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 = 0

Input features per sample.

int64_t out_features = 0

Output features per sample.

bool use_bias = true

Whether 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

builder

Where the nodes go.

x

An [N, in_features] input.

Returns

The [N, out_features] result's id.

Exceptions

Error

If x's inner extent is not in_features.

Shape output_shape(const Shape &input) const

Returns the per-sample shape forward() produces, [out_features].

Parameters

input

The per-sample input shape; must be [in_features].