I want to find if the layer is convolutional and linear from the entire network. If it is one of them, then I want to read the shape and parameters of the layer. I have found a solution to check if the module is convolutional or linear here. But I don’t find a way to read the parameters and shape of the corresponding layer. Would you please suggest a solution?
The posted condition would be the right approach and once the condition is met you could use e.g.
layer.parameters() depending on your use case.
Do you want to know the number of parameters & shape, or just copy/read the weights of each layer?
layer.weight.data worked for me. Thank you.