title: How to reduce the dimensions of a tensor with neural networks
body: <p>I have a 3D tensor of size [100,70,42] (batch, seq_len, features) and I would like to get a tensor of size [100,1,1] by using a neural network based on linear transformations (nn.Linear in Pytorch).</p>
  
  <p>I have implemented the following code</p>
  
  <pre><code>class Network(nn.Module):
     def __init__(self):
        super(Network, self).__init__()
        self.fc1 = nn.Linear(42, 120)
        self.fc2 = nn.Linear(120,1)
  
     def forward(self, input):
        model = nn.Sequential(self.fc1,
                              nn.ReLU(),
                              self.fc2)
        output = model(input)
        return output
  </code></pre>
  
  <p>However, upon training this only gives me an output of the shape [100,70,1], which is not the desired one.</p>
  
  <p>Thanks!</p>