OctonionLinearLayer<T>

Layers ยท AiDotNet.NeuralNetworks.Layers

Represents a fully connected layer using octonion-valued weights and inputs.

Inheritance: LayerBase<T> โ†’ OctonionLinearLayer<T>

Implements: IShapeContract

For Beginners

This layer is like a regular dense layer, but it uses 8-dimensional numbers (octonions) instead of regular numbers.

Benefits of octonion layers:

  • Can model more complex relationships with fewer parameters
  • Useful for certain types of image and signal processing
  • Better at capturing rotational relationships in data

The tradeoff is that computations are more expensive per parameter.

How It Works

An octonion linear layer performs matrix-vector multiplication in the 8-dimensional octonion algebra. Each weight and input is an octonion (8 real components), enabling the layer to capture more complex relationships than real-valued layers.

Constructors

Constructor Summary
OctonionLinearLayer(int inputFeatures, int outputFeatures, IActivationFunction<T> activationFunction) Initializes a new instance of the OctonionLinearLayer.

Properties

Property Summary
bool SupportsTraining { get; } Gets whether this layer supports training.
int InputFeatures { get; } Gets the number of input features (octonion-valued).
int OutputFeatures { get; } Gets the number of output features (octonion-valued).

Methods

Method Summary
Dictionary<string, string> GetParameterRoles() Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases).
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
void ClearGradients() Resets the internal state of the layer.
void ResetState()
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate) Updates the parameters of the layer using the calculated gradients.
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).