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

How to deal with out of cuda memory? #4

Closed
qiuzhen8484 opened this issue Sep 6, 2021 · 1 comment
Closed

How to deal with out of cuda memory? #4

qiuzhen8484 opened this issue Sep 6, 2021 · 1 comment

Comments

@qiuzhen8484
Copy link

Hello, looking for your reply. The code "self.CoVariance = torch.zeros(class_num, feature_num, feature_num).cuda()" needs too much cuda memory when the feature_num is large such as 2048. How to deal with it? I cannot put it onto a GPU.

@kxgong
Copy link
Collaborator

kxgong commented Sep 14, 2021

Hi, there are two ways to remedy this problem.

  1. Decrease the batch size.
  2. Approximate the covariance matrices by their diagonals, i.e., the variance of each dimension of the features. In this way, you only need to create a tensor with size (class_num, feature_num).

@kxgong kxgong closed this as completed Dec 11, 2022
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