title: save embedding layer in pytorch model
body: <p>i have this model:</p>
  
  <pre class="lang-py prettyprint-override"><code>class model(nn.Module):
      def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(in_channels=12,out_channels=64,kernel_size=3,stride= 1,padding=1)
        # self.conv2 = nn.Conv2d(in_channels=64,out_channels=64,kernel_size=3,stride= 1,padding=1)
        self.fc1 = nn.Linear(24576, 128)
        self.bn = nn.BatchNorm1d(128)
        self.dropout1 = nn.Dropout2d(0.5)
        self.fc2 = nn.Linear(128, 10)
        self.fc3 = nn.Linear(10, 3)
  
      def forward(self, x):
        x = F.relu(self.conv1(x))
        # x = F.relu(self.conv2(x))
        x = F.max_pool2d(x, (2,2))
        # print(x.shape)
        x = x.view(-1,24576)
        x = self.bn(F.relu(self.fc1(x)))
        x = self.dropout1(x)
        embeding_stage = F.relu(self.fc2(x))
        x = self.fc3(embeding_stage)
  
        return x
  </code></pre>
  
  <p>and i want to save the embeding_stage layer like i save the model here:</p>
  
  <pre><code>model = model()
  torch.save(model.state_dict(), 'C:\project\count_speakers\model_pytorch.h5')
  </code></pre>
  
  <p>thanks,
  Ayal</p>