Check initialization method of Conv2D

Hello community,

I have implemented a CNN using nn.Sequential and then I have applied a initialization method using


I would like to check if the layers have been initializated correctly. Is there any way to check it as a property?

Thanks in advance

Hi @Javier_Naranjo

I don’t think there is any generic way of testing it, since it depends on your init_method.
What you can do it looping over the parameters and checking some stats:

for name, p in net.named_parameters():
   check_method(name, p)

This check method could be looking at e.g. p.mean() or p.std() and you could draw a conclusion from it.

Hoping this answers somehow your question.

Inside init_method I am only calling a nn.init

My question was if there is any attribute where I can find the initialization method I have used.

Anyway, if there is not any chance, I would do that you mention.

Thanks for the reply

nn.init functions only run simple in-place init operations (without autograd) on the Tensor that represent the params. As you can see here (called there).
These operations don’t have any side effects except the change of values in the param Tensor.

Thanks for your help Serge!

1 Like