torch.nn.functional.cosine_embedding_loss#
- torch.nn.functional.cosine_embedding_loss(input1, input2, target, margin=0, size_average=None, reduce=None, reduction='mean')[source]#
Compute the cosine embedding loss.
See
CosineEmbeddingLoss
for details.- Parameters
input1 (Tensor) – Predicted values.
input2 (Tensor) – Predicted values.
target (Tensor) – Ground truth values.
margin (float, optional) – Margin for cosine embedding. Has a default value of 0.
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
Cosine embedding loss.
- Return type