W3cubDocs

/PyTorch 2.9

torch.nn.functional.hinge_embedding_loss

torch.nn.functional.hinge_embedding_loss(input, target, margin=1.0, size_average=None, reduce=None, reduction='mean') [source]

Compute the hinge embedding loss.

See HingeEmbeddingLoss for details.

Parameters
  • input (Tensor) – Predicted values.
  • target (Tensor) – Ground truth values.
  • margin (float, optional) – Margin for hinge loss. Has a default value of 1.
  • size_average (bool, optional) – Deprecated (see reduction).
  • reduce (bool, optional) – Deprecated (see reduction).
  • reduction (str, optional) – Specifies the reduction to apply to the output: ‘none’ | ‘mean’ | ‘sum’. ‘mean’: the mean of the output is taken. ‘sum’: the output will be summed. ‘none’: no reduction will be applied. Default: ‘mean’.
Returns

Hinge embedding loss.

Return type

Tensor

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.nn.functional.hinge_embedding_loss.html