Hi,
I have a trained model and I want to extract one of the layers as a vector of values.
For example, I want conv3
of the following model:
class Model(torch.nn.Module):
def __init__(self, num_inputs):
super(Model, self).__init__()
self.conv1 = nn.Conv2d(num_inputs, 32, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(32, 32, 3, stride=2, padding=1)
self.conv3 = nn.Conv2d(32, 32, 3, stride=2, padding=1)
self.conv4 = nn.Conv2d(32, 32, 3, stride=2, padding=1)
def forward(self, inputs):
x = F.elu(self.conv1(inputs))
x = F.elu(self.conv2(x))
x = F.elu(self.conv3(x))
x = F.elu(self.conv4(x))
return x
Any suggestions of how to do it?