I have a self-defined conv kernel generated by one parameter. How to make the module update the parameter?

The new convolution kernel is generated by one parameter (such as gaussian kernel generated by sigma, suppose the kernel size is 3).

At the very beginning, we set sigma=0.5, and we get a convolution kernel. When backward, we need to use the gradient info to update sigma, and re-generate the kernel.

How can I update the sigma?

Ok, I’ve solved this.

So the basic solution is that, we need to regenerate the kernels every time after we update the sigma. To update sigma, specify it in `self._parameters`

. And in `forward()`

function, regenerate the kernels. Remember to do all the operations on GPU, otherwise the procedure may be slower.