How to link weights between forward and backward pass in custom layer?

Hello,

I want to create a custom convolution layer. I will add weights (and biaises, …) to my layer and make a custom computation for the forward pass. For this, I found some examples (and look to conv2D in module.nn)

I have 2 questions:

  • First, how am I sure that the backward pass will take care of my parameters? As far as I saw, creating them (like in conv2D) should do the trick but I’d like to be sure. Am I right?
  • Second, is there any standard procedure to test a new layer? A standard test?

Thank you for your answer. Doms.