LocalObjectiveStep<T>

Models & Types · AiDotNet.Interfaces

State shared by every local objective of one training step.

Properties

Property Summary
Func<Tensor<T>, Tensor<T>, Tensor<T>> Loss { get; } The network’s tape loss (prediction, target) → scalar.
Func<Tensor<T>, Tensor<T>, Tensor<T>> ReadoutLoss { get; } The scalar task loss of a hidden state through the shared readout, Loss(Readout(h), target).
Func<Tensor<T>, Tensor<T>, Tensor<T>> ReadoutLossDetached { get; } Evaluates the scalar task loss of a hidden state through the shared readout while detaching the shared readout’s own trainable parameters so only the hidden state h receives gradient.
Func<Tensor<T>, Tensor<T>> Readout { get; } Runs the shared readout (the trailing ReadoutLayerCount layers) on a hidden state.
IEngine Engine { get; } The engine recording the step’s tape.
Tensor<T> Input { get; } The step’s network input (for a language model: token ids).
Tensor<T> Target { get; } The step’s target, aligned the same way the network’s own training step aligns it.
int HiddenLayerCount { get; } Number of hidden (pre-readout) trainable layers that are offered a local objective this step.