I registered a,b,c as nn.Parameter and generated kernel using a, b, c with some operation like add, multiply. When I apply some operation to (a, b, c), the kernel becomes tensor, not nn.Parameter. But, F.conv3d can only receive nn.Parameter as weight. I got this error.
x = F.conv3d(x, self.kernel, stride=1, padding=self.padding)
RuntimeError: Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the gradient
If I change the kernel to nn.Parameter, it becomes a leaf node and has no grad_fn. (a, b, c) can’t be trained anymore. How can I train the parameter in pytorch?
I use pytorch 1.5, cuda10.1, cudnn7.5
Thank you