ptrblck:

So how about we just store the filter weights as nn.Parameters in __init__ and just use the functional API ( F.conv2d ) in the forward method. Would that work at all? Sure! Since you’ve properly registered the filter weights in __init__ , they will be trained as long as they are used somewhere in the computation during your forward pass.


Thankyou very much for this use case. I in essence understand what is being illustrated in these lines. But because i am still a novice in coding, can a very quick code be given so that i can understand how a weights of conv can be set as parameter in init and then using F.conv they will be updated. Thankyou for this seemingly redundant need but helps me a lot.