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

Loss function problems #34

Open
jacky4323 opened this issue Aug 30, 2018 · 1 comment
Open

Loss function problems #34

jacky4323 opened this issue Aug 30, 2018 · 1 comment

Comments

@jacky4323
Copy link

Hi ,

thanks for your great work
I have some questions.
Why in the details implementation, just use square than mean,not using L2-norm in the paper you described?

image

def at(x):
    return F.normalize(x.pow(2).mean(1).view(x.size(0), -1))


def at_loss(x, y):
    return (at(x) - at(y)).pow(2).mean()
@lndip
Copy link

lndip commented Sep 26, 2024

Hi, I also wonder why mean(1) is in line F.normalize(x.pow(2).mean(1).view(x.size(0), -1)) instead of sum(1) as described in the paper. Have you got any different performance in this 2 versions?
And the normalization, should it be sample-wise normalization as F.normalize(x.pow(2).mean(1).view(x.size(0), -1), dim=-1) ? Because the code is currently using batch statistics to normalize the features.

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