I have a pretrained network whose layers have similar names like the following code. Is there any way to extract the features from the intermediate layer?
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(...)
self.conv2 = nn.Conv2d(....)
self.conv3 = nn.Conv2d(....)
def forward(self, x1):
x1 = self.conv1(x1)
x1 = self.conv2(x1) <-------------------- the variable that I want to visualize
x1 = self.conv3(x1)
x1
return x1