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

Scalar multiplication with complex numbers and torch.Tensor Scalars #24

Closed
ausstein opened this issue Jul 5, 2024 · 0 comments · Fixed by #23
Closed

Scalar multiplication with complex numbers and torch.Tensor Scalars #24

ausstein opened this issue Jul 5, 2024 · 0 comments · Fixed by #23

Comments

@ausstein
Copy link
Contributor

ausstein commented Jul 5, 2024

Issue: Allowing Scalar Multiplications with Complex Numbers in Tensor Trains

Description:

  • When using torchTT, scalar multiplications with complex numbers are not supported. This seems to be an oversight as everything works perfectly when they are allowed.
  • Also multiplying with torch.Tensor scalars isinstance(other, tn.tensor) raises "TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union"

Steps to Reproduce:

  1. Attempt to multiply a tensor train with a complex scalar or torch.Tensor scalar.
  2. Observe the error.

Proposed Solution:
I have created a pull request to address this issue by:

  • Changing isinstance(other, tn.tensor) to isinstance(other, tn.Tensor) in def __mul__(self, other).
  • Adding support for complex scalars by adding or isinstance(other, complex).
  • Updating the descriptions and error messages accordingly.

Related Pull Request:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant