I am new to pytorch, and i am trying to implement Resnet, and get the hidden layer of the input in every layer.
How can I do that?
The problem is that after adding layers to nn.sequential. I don’t have a way to get the hidden of each layer (not each block, but each layer inside each block)
One way to get the values is by iterating over the model. I usually do something like this:
temp=[]
for layer in model.parameters():
temp.append(layer)
print(temp)
If layers are in blocks, you may need to add a second nested iterator.