Hi, albanD @albanD,
First, the p and q is just for simplistic expression, I use other variable to replace them in the real code, so dont worry about this, my code now could run successfully, but maybe slow  
Second, Is there any better method I could try to avoid this for loops mode?  My purpose is not like real convolution, but to convolute different kernels at different position[hh, ww], so normal convolution operation might not suitable for me
Finally, did you mean that prop_f itself won’t have grad after all this?  but the grad from deeper layer will still propagate to self.old_f  and  kernels right? and then adjust  self.old_f  and  kernels  w.r.t. corresponding layers who generate them?
THX!! albanD