(self, temperature=0.07, contrast_mode='all',
base_temperature=0.07)
| 37 | It also supports the unsupervised contrastive loss in SimCLR |
| 38 | From: https://github.com/HobbitLong/SupContrast""" |
| 39 | def __init__(self, temperature=0.07, contrast_mode='all', |
| 40 | base_temperature=0.07): |
| 41 | super(SupConLoss, self).__init__() |
| 42 | self.temperature = temperature |
| 43 | self.contrast_mode = contrast_mode |
| 44 | self.base_temperature = base_temperature |
| 45 | |
| 46 | def forward(self, features, labels=None, mask=None): |
| 47 | """Compute loss for model. If both `labels` and `mask` are None, |
nothing calls this directly
no outgoing calls
no test coverage detected