Task Loss#

Task-Level Losses#

Standard objectives used for training quantum–hypercausal models.

class qmlhc.loss.task.CrossEntropyLoss[source]#

Bases: object

Cross-entropy for probabilistic outputs normalized over classes.

Notes

Inputs are clipped to [1e-12, 1.0] and normalized to sum to 1.0 prior to computing the negative log-likelihood.

class qmlhc.loss.task.MAELoss[source]#

Bases: object

Mean Absolute Error (MAE) between predicted and target tensors.

Notes

Both inputs are flattened to 1-D before comparison.

class qmlhc.loss.task.MSELoss[source]#

Bases: object

Mean Squared Error (MSE) between predicted and target tensors.

Notes

Both inputs are flattened to 1-D before comparison.

class qmlhc.loss.task.TaskLoss(*args, **kwargs)[source]#

Bases: LossFn, Protocol

Base protocol for any task-level loss function.

__call__(pred, target)[source]#

Compute a scalar loss given prediction and target tensors.