Contents

class

SushiAI::NN::ILayer

One layer of a model whose architecture came from a file.

Declared in
include/SushiAI/nn/ilayer.hpp

Public member functions

virtual ~ILayer()=default
virtual Graph::ValueId forward(const Graph::GraphBuilder &builder, Graph::ValueId x)=0

Traces the layer, declaring its parameters on first call.

Parameters

builder

Where the nodes go.

x

The input value.

Returns

The result's id.

virtual void walk_parameters(std::string_view prefix, const ParameterVisitor &visitor)=0

Applies visitor to every declared parameter this layer owns.

Parameters

prefix

The name prefix this layer's parameters hang under.

visitor

Called once per declared parameter.

virtual Shape output_shape() const noexcept=0

Returns the per-sample shape after this layer, batch axis excluded.

int64_t output_features() const noexcept

Returns the element count of output_shape().