I would like to iterate over the values of a convolutional layer. I have done the following:
for thisMod in net.modules(): if hasattr(thisMod, 'weight'): weightData = thisMod.weight.data.numpy() biasData = thisMod.bias.data.numpy() if isinstance( thisMod, torch.nn.modules.conv.Conv2d ): print( weightData.shape )
Rather than weightData being the array of size [30,3,3,3] array (where 30 is the number of out channels), weightData is of size [3,3,3]. I suspect that this is one channel.
How do I iterate over the channels of a convolutional layer?