I’m trying to create a model that takes a matrix of 5 x 2 (5 samples of 2 channel audio) and outputs something that is 1 x 20. At present this isn’t happening and it’s outputting 5 x 20, and I think/know this is down to how matrix multiplication works - but I was wondering how do I get it outputting my desired output shape. Below is some pseudo-code for my model.
class FFN(nn.Module):
   def __init__(self):
       super(FFN, self).__init__()
       self.hidden1 = nn.Linear(2, 128)
       self.hidden2 = nn.Linear(128, 128)
       self.output = nn.Linear(128, 20)

   def forward(self, x):
       output = self.output(F.relu(self.hidden2(F.relu(self.hidden1(x)))))
       return output  

So I think the reason it’s giving me a 5 x 20 output is that the matrix multiplication is working as below.
A = 5 x 2
B = 2 x 128
C = 128 x 20
AB = 5 x 128
(AB)C = 5 x 20.