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

torch concat backward compatibility #4901

merged 2 commits into from
Dec 2, 2022

Conversation

mojtaba-komeili
Copy link
Contributor

Patch description
Backward compatibility for torch.concat function in cringe loss.

Comment on lines 91 to 99
if hasattr(torch, 'concat'):
# torch > 1.10
x_ct = torch.concat(
[x_target.unsqueeze(1), sample_preds_values.unsqueeze(1)], -1
)
else:
x_ct = torch.cat(
[x_target.unsqueeze(1), sample_preds_values.unsqueeze(1)], -1
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could just do torch.cat to avoid the check? pretty sure it's just an alias

@mojtaba-komeili mojtaba-komeili merged commit c1c6d91 into main Dec 2, 2022
@mojtaba-komeili mojtaba-komeili deleted the torch-cat branch December 2, 2022 21:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants