Can we use complex weights with convolution layers?


My ground truth is complex-valued. The input can be real valued or complex but the output needs to be complex. Making the output as two channel image and using [


](torch.view_as_complex — PyTorch 1.8.1 documentation). But that doesn’t give good results.

so, I am trying to make the input as well the weights of the NN to be complex. But I get the following error message:
RuntimeError: “unfolded2d_copy” not implemented for ‘ComplexFloat’

(minimal program to reproduce the error)
import torch
import torch.nn as nn

c1 = nn.Conv2d(1, 32, 3, 1)
c1(torch.ones([3,1,20,20], dtype=torch.cfloat))

The feature request seems to be tracked here (as well as the related issues posted in the linked issue) and so far the workaround seems to be to split these operations into the re and im part (as you already did).