Skip to content

Commit

Permalink
Added a note about optional labels
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMusgrave committed Jun 29, 2022
1 parent 14f11d6 commit 9ce72ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/losses.md
Expand Up @@ -17,6 +17,12 @@ miner_output = miner_func(embeddings, labels) # in your training for-loop
loss = loss_func(embeddings, labels, miner_output)
```

For some losses ([ContrastiveLoss](#contrastiveloss), [NTXentLoss](#ntxentloss), [TripletMarginLoss](#tripletmarginloss) etc.), you don't need to pass in labels if you are already passing in pair/triplet indices:
```python
loss = loss_func(embeddings, indices_tuple=pairs)
```


You can specify how losses get reduced to a single value by using a [reducer](reducers.md):
```python
from pytorch_metric_learning import reducers
Expand Down

0 comments on commit 9ce72ca

Please sign in to comment.