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

np.where prevents CUDA Tensors from compressing #24

Closed
dakami opened this issue Apr 3, 2021 · 0 comments
Closed

np.where prevents CUDA Tensors from compressing #24

dakami opened this issue Apr 3, 2021 · 0 comments

Comments

@dakami
Copy link

dakami commented Apr 3, 2021

https://github.com/rballester/tntorch/blob/master/tntorch/round.py#L139

    where = np.where((torch.cumsum(S[reverse], dim=0).detach().cpu() <= delta**2))[0]

If S is located on the device, np.where causes a cpu/gpu conflict.

Replacing np.where with torch.where and removing the cpu() call allows both CPU and GPU compressed tensors to work. Unclear if detach is necessary or if it causes resource leaks.

Cool code!

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