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

Out of Memory #9

Open
PHChenGit opened this issue Dec 31, 2024 · 0 comments
Open

Out of Memory #9

PHChenGit opened this issue Dec 31, 2024 · 0 comments

Comments

@PHChenGit
Copy link

Hi,

I'm trying to reproduce your work with my GPU RTX 4090.
But I got Error about GPU memory out of memory when computing bmm()
Do you have any suggest to fix or avoid this error?

Thanks for your help.

def compute_similarity(features_a, features_b):
    b, c, h, w = features_a.shape
    features_a = features_a.transpose(2, 3).contiguous().view(b, c, h*w)
    features_b = features_b.view(b, c, h*w).transpose(1, 2)
    features_mul = torch.bmm(features_b, features_a)
    correlation_tensor = features_mul.view(b, h, w, h*w).transpose(2, 3).transpose(1, 2)
    correlation_tensor = F.normalize(F.relu(correlation_tensor), p=2, dim=1)
    return correlation_tensor
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