torchdiffeq icon indicating copy to clipboard operation
torchdiffeq copied to clipboard

complex support ?

Open tesla-cat opened this issue 5 years ago • 5 comments

TypeError: `y0` must be a floating point Tensor but is a torch.ComplexDoubleTensor

tesla-cat avatar Oct 30 '20 14:10 tesla-cat

Until PyTorch's support for complex numbers comes out of beta, it probably won't be added to the core library.

You can in the mean time represent complex tensors with a real tensor twice as big. If your ODE needs complex support, view_as_complex and view_as_real should allow you to use it with torchdiffeq.

rtqichen avatar Oct 30 '20 16:10 rtqichen

Now that PyTorch does support complex numbers, is there a straightforward way to adapt the ODE solvers to take complex input? The _assert_floating function called by _check_inputs will raise an error when trying complex tensors, by bypassing or altering these checks will the complex supported Pytorch (version 1.8.0 and higher) be able to compute the gradients?

alidiak avatar Dec 17 '21 19:12 alidiak

I think that this is resolved by #219

sriharikrishna avatar Mar 08 '23 21:03 sriharikrishna

I just ran into the same issue and I did pip install git+https://github.com/rtqichen/torchdiffeq, so I think that #219 does not solve this.

iranroman avatar Jun 11 '23 23:06 iranroman

Do you have an MWE?

sriharikrishna avatar Jun 15 '23 21:06 sriharikrishna