How we should convert an array containing np.complex128 datatype (say a complex 2d numpy array) into a torch .complex128 array of the same dimension?
torch.from_numpy should work:
a = np.random.randn(10, 10) a = a.astype(np.complex128) print(a.dtype) # complex128 x = torch.from_numpy(a) print(x.dtype) # torch.complex128
Thank you ptrblck for solving the issue. The same command was not working a few days ago and now it is working well.