Skip to content

Commit

Permalink
torch concat backward compatibility (facebookresearch#4901)
Browse files Browse the repository at this point in the history
* cat or concat

* back to cat
  • Loading branch information
mojtaba-komeili authored Dec 2, 2022
1 parent 9fcd098 commit c1c6d91
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions projects/cringe/cringe_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ def __call__(self, x, y, classifier_labels=None, **kwargs):

# concatenate the logits of the preds with the actual label's logits
x_target = x[torch.arange(x.shape[0]), y]
x_ct = torch.concat(
[x_target.unsqueeze(1), sample_preds_values.unsqueeze(1)], -1
)
x_ct = torch.cat([x_target.unsqueeze(1), sample_preds_values.unsqueeze(1)], -1)
# get the y's for the x_ct (the correct label is index 0 if
# the target is positive and index 1 if the target is negative)
y_ct = torch.abs(torch.abs(classifier_labels) - 1).type(y.dtype).to(x_ct.device)
Expand Down

0 comments on commit c1c6d91

Please sign in to comment.