training_step_adapter
orchard.tasks.classification.training_step_adapter
¶
Classification Training Step Adapter.
Wraps the standard classification forward pass (logits + criterion) to
satisfy :class:~orchard.core.task_protocols.TaskTrainingStep.
ClassificationTrainingStepAdapter
¶
Computes classification training loss with optional MixUp blending.
compute_training_loss(model, inputs, targets, criterion, mixup_fn=None, device=None)
¶
Execute classification forward pass and compute loss.
When mixup_fn is provided, inputs and targets are blended
before the forward pass and the loss is computed as a convex
combination of the two target sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Neural network producing logits. |
required |
inputs
|
Any
|
Batch of input tensors. |
required |
targets
|
Any
|
Batch of target tensors. |
required |
criterion
|
Module
|
Loss function (e.g. CrossEntropyLoss). |
required |
mixup_fn
|
Callable[..., Any] | None
|
Optional MixUp augmentation callable. |
None
|
device
|
device | None
|
Target device for tensor placement. |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Scalar loss tensor for backward pass. |