nn_cosine_embedding_loss {torch} | R Documentation |
Cosine embedding loss
Description
Creates a criterion that measures the loss given input tensors
,
and a
Tensor
label with values 1 or -1.
This is used for measuring whether two inputs are similar or dissimilar,
using the cosine distance, and is typically used for learning nonlinear
embeddings or semi-supervised learning.
The loss function for each sample is:
Usage
nn_cosine_embedding_loss(margin = 0, reduction = "mean")
Arguments
margin |
(float, optional): Should be a number from |
reduction |
(string, optional): Specifies the reduction to apply to the output:
|
Details
[Package torch version 0.13.0 Index]