Single-Model Mixin#
Module for the single-model mixin class.
- class SingleModelMixin[source]
Bases:
objectMixin that defines the forward pass and optimizer configuration for solvers backed by exactly one model. Provides properties to access the single model, optimizer, and scheduler.
Designed to be used in combination with any solver inheriting from
BaseSolver.- forward(x)[source]
The forward pass implementation for the single model, which simply evaluates the model on the input.
- Parameters:
x (torch.Tensor | LabelTensor | Data | Graph) – The input data.
- Returns:
The output of the single model.
- Return type:
torch.Tensor | LabelTensor | Data | Graph
- configure_optimizers()[source]
Configure the optimizer and scheduler for the single model.
- Returns:
The optimizer and the scheduler
- Return type:
- property model
The single model used by the solver.
- Returns:
The single model used by the solver.
- Return type:
- property optimizer
The optimizer used by the solver.
- Returns:
The optimizer used by the solver.
- Return type:
- property scheduler
The scheduler used by the solver.
- Returns:
The scheduler used by the solver.
- Return type: