Skip to content

Commit 1439148

Browse files
authored
style(eltociear): fix typo in contrastive_loss.py
postive -> positive
1 parent a6e88cb commit 1439148

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ding/torch_utils/loss/contrastive_loss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
7979
x_n = x.view(-1, self._encode_shape)
8080
y_n = y.view(-1, self._encode_shape)
8181

82-
# Use inner product to obtain postive samples.
82+
# Use inner product to obtain positive samples.
8383
# [N, x_heads, encode_dim] * [N, encode_dim, y_heads] -> [N, x_heads, y_heads]
8484
u_pos = torch.matmul(x, y.permute(0, 2, 1)).unsqueeze(2)
8585
# Use outer product to obtain all sample permutations.
@@ -92,7 +92,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
9292
u_neg = (n_mask * u_all) - (10. * (1 - n_mask))
9393
u_neg = u_neg.view(N, N * x_heads, y_heads).unsqueeze(dim=1).expand(-1, x_heads, -1, -1)
9494

95-
# Concatenate postive and negative samples and apply log softmax.
95+
# Concatenate positive and negative samples and apply log softmax.
9696
pred_lgt = torch.cat([u_pos, u_neg], dim=2)
9797
pred_log = F.log_softmax(pred_lgt * self._temperature, dim=2)
9898

0 commit comments

Comments
 (0)