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

DCLW bug? #1

Closed
tangzhy opened this issue Nov 17, 2021 · 2 comments
Closed

DCLW bug? #1

tangzhy opened this issue Nov 17, 2021 · 2 comments

Comments

@tangzhy
Copy link

tangzhy commented Nov 17, 2021

In DCLW, your code is like:

weight_fn = lambda z1, z2: 2 - z1.size(0) * torch.nn.functional.softmax((z1 * z2).sum(dim=1) / sigma, dim=0).squeeze()

I think the right way shall be like:

weight_fn = lambda z1, z2: 2 - torch.nn.functional.softmax((z1 * z2).sum(dim=1) / sigma, dim=0).squeeze()

z1.size(0) is not a variable introduced in the origin paper.

What do you think of it?

@raminnakhli
Copy link
Owner

Hi Zhengyang,
Thanks for the feedback. Actually, for the DCLW loss, the paper uses the expectation of the exp(z1, z2) in the denominator, which is basically the mean over these values. So, that is why I've multiplied the results with z1.size(0) (the number of elements that we're applying the mean on).
Please let me know if this doesn't make sense.

@raminnakhli
Copy link
Owner

I'll close this issue as there hasn't been an activity for a while. Please open another issue if the question still stands.

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

2 participants