Hi,
I have a feeling the issue here is that your input is initialized in float32 (PyTorch’s default dtype, if you want to change it across the entire script you need to use torch.set_default_dtype(torch.cfloat).
What you could try is to cast your input variable into cfloat and pass it through the network via,
input = torch.rand(4).reshape(-1,1)
input = torch.complex(input, torch.zeros_like(input))
input.requires_grad = True
nn, En = net(input)
Loss = diffeq_residual(input, nn, En)
print(Loss)

and see if that works!