cayleypy.train.MseLoss

class cayleypy.train.MseLoss[source]

Mean squared error loss.

This is the default way to regress distances. Because the penalty grows quadratically, a few badly predicted states matter more than many slightly wrong ones.

Example:

>>> import torch
>>> from cayleypy.train import MseLoss
>>> float(MseLoss()(torch.tensor([1.0, 2.0]), torch.tensor([2.0, 2.0])))
0.5
__init__()

Methods

__init__()

elementwise(predictions, targets)

Computes squared error for every element.

elementwise(predictions: Tensor, targets: Tensor) → Tensor[source]

Computes squared error for every element.

Parameters:
  • predictions – Predicted distances.

  • targets – Target distances, of the same shape as predictions.

Returns:

Tensor of the same shape as predictions, with squared errors.