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

Anyone encounter getting nan cxloss? #30

Open
gitlabspy opened this issue Jan 26, 2022 · 3 comments
Open

Anyone encounter getting nan cxloss? #30

gitlabspy opened this issue Jan 26, 2022 · 3 comments

Comments

@gitlabspy
Copy link

gitlabspy commented Jan 26, 2022

def __calculate_CS(self, scaled_distances, axis_for_normalization = TensorAxis.C):

This op is very unstable, the value goes inf after exp, any solution?

@FeiiYin
Copy link

FeiiYin commented Jun 3, 2022

Same on me.

@FeiiYin
Copy link

FeiiYin commented Jun 3, 2022

Try this [issue].

@FeiiYin
Copy link

FeiiYin commented Jun 4, 2022

Add clamp() in compute_relative_distance() to prevent the exp index too large, which works for me.

def compute_relative_distance(dist_raw):
    dist_min, _ = torch.min(dist_raw, dim=2, keepdim=True)
    dist_tilde = dist_raw / (dist_min + 1e-5)
    dist_tilde = torch.clamp(dist_tilde, max=10., min=-10)
    return dist_tilde

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