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

ops.mul() needs long, byte or bool #43

Open
bastiengiraud opened this issue Apr 3, 2023 · 1 comment
Open

ops.mul() needs long, byte or bool #43

bastiengiraud opened this issue Apr 3, 2023 · 1 comment

Comments

@bastiengiraud
Copy link

Hi All,

When I'm trying to do this simple element wise multiplication:

"""
A = tn.ones(10,10).to(torch.long)
B = tn.rand(10,10).to(torch.long)

result = tn.mul(A,B)
"""

I get an error saying that tensors used as indices must be long, byte or bool. However, it seems like the error is produced within the tn.cross function. Any ideas on how to fix this?

long, byte or bool

Thank you and cheers,
Bastien

@rballester
Copy link
Owner

Hi Bastien, I just tested this (with PyTorch 2.0) and this error is not thrown, but an error at a later point is thrown instead:

RuntimeError: linalg.vector_norm: Expected a floating point or complex tensor as input. Got Long

At the moment, several tensor algorithms like cross-approximation will work for floating-point data only, as PyTorch functions like torch.linalg.norm don't support integer types yet.

You can still do element-wise multiplication of two compressed tensors like this: A*B. However, keep in mind that for larger tensors this is less efficient than the cross-approximated version tn.mul().

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