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

Question about contrastive loss margin #6

Open
sofiapvcp opened this issue May 20, 2024 · 0 comments
Open

Question about contrastive loss margin #6

sofiapvcp opened this issue May 20, 2024 · 0 comments

Comments

@sofiapvcp
Copy link

Hi! Thanks for the repo.

Would you mind clarifying why isn't the max_dist variable detached in the "margin" loss function? Wouldn't gradients flow through it the way it is at the moment? I've tried detaching it and the loss does behave differently.

max_dist = (dist * mask).max()

https://github.com/wzhouad/Contra-OOD/blob/2a1d63a61c8b03efdc27ca08b22f5fab2bc6001d/model.py#L42C17-L42C47

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant