Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

torch concat backward compatibility #4901

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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