Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Bugs in the f function of cw.py #184

Open
EthanChu7 opened this issue May 19, 2024 · 2 comments
Open

[BUG] Bugs in the f function of cw.py #184

EthanChu7 opened this issue May 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@EthanChu7
Copy link

✨ Short description of the bug [tl;dr]

Bugs in the f function of cw.py when facing negative logits

💬 Detailed code and results

In f function of cw.py, the real and other are computed by

other = torch.max((1 - one_hot_labels) * outputs, dim=1)[0]
real = torch.max(one_hot_labels * outputs, dim=1)[0]

Howerver, when facing negative logits(negative other label logits in other and negative target label in real), the other and real become zero.

I suggest to make the following modifications:

other = torch.max((1 - one_hot_labels) * outputs - one_hot_labels * 1e4, dim=1)[0] 
real = torch.sum(one_hot_labels*outputs, dim=1)
@EthanChu7 EthanChu7 added the bug Something isn't working label May 19, 2024
@rikonaka
Copy link
Contributor

rikonaka commented May 20, 2024

Hi @EthanChu7 , good question, this bug already fix by this pull #168, but it’s has not been merged into the main line yet. 👍👍👍

@EthanChu7
Copy link
Author

thx for the reply, i m satisfied with the modifications in pull #168, looking forward to see them in the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants