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

LazyTensor.ndim not giving correct value #376

Open
JonasDeSchouwer opened this issue Jul 7, 2024 · 2 comments
Open

LazyTensor.ndim not giving correct value #376

JonasDeSchouwer opened this issue Jul 7, 2024 · 2 comments

Comments

@JonasDeSchouwer
Copy link

The title says it all.

Minimal example:

import torch
from pykeops.torch import LazyTensor

x = LazyTensor(torch.rand((5,1,8)))

print(x.shape)  # (5,1,8)   -> correct
print(x.ndim)   # 8         -> incorrect: always x.shape[-1]

As you can see, the last print should have '3' as output, but instead has '8'. Some experimenting showed that the returned value seems to always be x.shape[-1].

My environment:

  • Windows + WSL (Ubuntu 24.04)
  • torch: 2.2.2+cu121
  • pykeops: 2.2.3
@huguesva
Copy link

huguesva commented Jul 8, 2024

As a remark, I noticed the same thing and resorted to using len(x.shape).

@JonasDeSchouwer
Copy link
Author

Yes, I did the same. But it would of course be nicer (and not lead to weird errors for developers expecting the normal behaviour)

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