ntxent_loss
NTXentLoss
Bases: NTXentLoss
NTXentNegativeMinedLoss: NTXentLoss with explicitly mined negatives
Source code in fmcib/ssl/losses/ntxent_loss.py
__init__(temperature=0.1, gather_distributed=False)
Initialize an instance of the class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
temperature
|
float
|
The temperature parameter for the instance. Defaults to 0.1. |
0.1
|
gather_distributed
|
bool
|
Whether to gather distributed data. Defaults to False. |
False
|
Source code in fmcib/ssl/losses/ntxent_loss.py
forward(out)
Forward pass through Negative mining contrastive Cross-Entropy Loss.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
out
|
List[Tensor]
|
List of tensors |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
Contrastive Cross Entropy Loss value. |