`lt` does not support torch.complex Tensors
Zymrael opened this issue · comments
To reproduce
import torch
import lovely_tensors as lt
lt.monkey_patch()
x = torch.randn(4, dtype=torch.complex32)
x
Gives
RuntimeError: isposinf does not support complex inputs.
Hi. Thank you for the report.
Do you have a concrete use case for complex tensors?
I will make sure lt can handle them, but do you have ideas on what a concise and informative representation of a complex tensor should look like?
Besides a text summary, is there a graphical representation that would make sense?
I've pushed a quick fix that just displays the plain version for complex tensors.
# We don't really supposed complex numbers yet
c = torch.randn(10, dtype=torch.complex64)
c
tensor([ 0.5135+0.0645j, -0.2751+0.3733j, -0.2552-0.0428j, 0.0518+0.5789j, 1.0469+0.2439j, -1.0070-0.0823j,
0.1538-0.0330j, -1.0137-0.4006j, -0.3007+0.1856j, -1.0176+0.3687j])
Let's keep the issue open because there is definitely room for improvement.
A simple solution would be to treat real and imaginary parts of the tensor as two different tensors, perhaps using torch.view_as_real
A simple solution would be to treat real and imaginary parts of the tensor as two different tensors, perhaps using
torch.view_as_real
Could you suggest a codebase, ideally a notebook, that is heavily using complex tensors? I feel that I still need to better understand how people use them in real code.