class
SushiAI::NN::LayerAdapter
template <typename L>Adapts a compile-time Module to the runtime ILayer interface.
- Declared in
include/SushiAI/nn/ilayer.hpp- Inherits
SushiAI::NN::ILayer
Template parameters
LWrapped layer type satisfying the Module contract.
Public member functions
LayerAdapter(L layer, Shape output_shape)Wraps a module instance with the per-sample shape it produces.
Parameters
output_shapeMust equal what
layertraces, batch axis excluded.
LayerAdapter(L layer, int64_t output_features)Wraps a module instance that produces a rank-1 feature vector.
Parameters
output_featuresMust be positive; the shape becomes [output_features].
virtual Graph::ValueId forward(const Graph::GraphBuilder &builder, Graph::ValueId x) overrideTraces the layer, declaring its parameters on first call.
Parameters
builderWhere the nodes go.
xThe input value.
Returns
The result's id.
virtual void walk_parameters(std::string_view prefix, const ParameterVisitor &visitor) overrideApplies visitor to every declared parameter this layer owns.
Parameters
prefixThe name prefix this layer's parameters hang under.
visitorCalled once per declared parameter.
virtual Shape output_shape() const noexcept overrideReturns the per-sample shape after this layer, batch axis excluded.
L & layer() noexceptThe wrapped layer, for a test that wants to inspect it.
const L & layer() const noexceptThe wrapped layer, read-only.

