mapping_networks.losses.TrainingContext¶
- class mapping_networks.losses.TrainingContext(predictions: ~typing.Any, targets: ~typing.Any, latent_vectors: dict[str, ~torch.Tensor], generated_parameters: ~mapping_networks.runtime.parameter_tree.ParameterTree, perturbed_predictions: ~typing.Any | None = None, mapper_weights: dict[str, ~torch.Tensor] = <factory>)¶
Carry all information loss components need in one object.
Built by the trainer from
ForwardResultplus batch targets. Individual loss components read only the fields they need, so the trainer does not have to know which losses are active.- predictions¶
Raw output from the target model forward pass.
- Type:
Any
- targets¶
Ground-truth labels or regression targets from the batch.
- Type:
Any
- latent_vectors¶
Mapping from stable latent names to their trainable tensors (directly from
ForwardResult.latent_vectors).- Type:
dict[str, torch.Tensor]
- generated_parameters¶
The
ParameterTreeused in this forward pass.
- perturbed_predictions¶
Target output from perturbed latent vectors. Populated only when stability loss is active and the model has been re-run with noise-injected latents.
- Type:
Any | None
- mapper_weights¶
Optional mapping from latent names to their mapper’s modulated weight matrices. Used by alignment loss to compute cosine distance between latent vectors and weight summaries.
- Type:
dict[str, torch.Tensor]
- __init__(predictions: ~typing.Any, targets: ~typing.Any, latent_vectors: dict[str, ~torch.Tensor], generated_parameters: ~mapping_networks.runtime.parameter_tree.ParameterTree, perturbed_predictions: ~typing.Any | None = None, mapper_weights: dict[str, ~torch.Tensor] = <factory>) None¶
Methods
__init__(predictions, targets, ...)Attributes