class
SushiAI::Train::IObjective
What a model is being trained to minimise.
- Declared in
include/SushiAI/train/objective.hpp
Public member functions
virtual ~IObjective()=defaultvirtual void declare(const Graph::GraphBuilder &builder, ObjectiveLeaves &leaves) const =0Declares whatever leaves the graph needs beyond the model's input.
Parameters
builderWhere the leaves go.
leavesWhere to record them, by role.
virtual Graph::ValueId loss(const Graph::GraphBuilder &builder, const Graph::Graph &graph, Graph::ValueId output, const ObjectiveLeaves &leaves) const =0Computes scalar loss from model output.
Parameters
builderWhere the nodes go.
graphThe graph, for checking shapes.
outputThe model output value.
leavesDeclared auxiliary leaves.
Returns
The scalar loss value identifier.
virtual std::optional< Metric > score(const Data::Batch &batch, const SushiBLAS::Tensor &output) const =0An optional per-step metric: accuracy, mAP, an L2 residual, or none.
Parameters
batchThe batch that was just stepped.
outputThe model's output tensor.
Returns
The metric, or std::nullopt when this objective offers none.
virtual std::string_view name() const noexcept=0A short name for a run report.

