Hi all, I am trying to calculate the SVD of some complex matrices. It worked fine on the CPU, but when it comes to the GPU, some errors happened, here is the snippet of my code and its corresponding output:

Does this mean that the torch.svd does not support the complex tensor on the GPU? I checked some posts and issues, it seemed that this functionality is actually supported on GPU: https://github.com/pytorch/pytorch/pull/42738

Can anyone give some suggstions on this? Thanks in advance!

I tried the nightly version and yes, this version supported the (forward) computation of SVD for comlex matrix, but when I implemented a customized layer which included this complex matrix SVD cmputation, and put this layer inside my model, during the training time the following error occurred:

RuntimeError: svd does not support automatic differentiation for outputs with complex dtype.

It seems like 1.8 verson still does not support the aotugrad for SVD when complex matrix is used, any suggestions or should I wait Pytorch develop team to improve this functionality?

Yes, I think waiting is probably the best option. Complex tensors are
currently a work in progress in pytorch.

As a further note, I’ve been thinking about this some, and I don’t fully
understand how autograd ought to work with complex tensor functions.
If I can get my thoughts sorted out on this I will likely post something,
but right now I am very confused by the whole thing.