ddd24:

I get an error  that the size [1 x 10 x 128] is invalid for input with 12800 elements.


You won’t be able to get a tensor C of size [1 x 10 x 128] by a matrix multiplication. As the error says, if
A.view(-1, 4) # is of size [1280 x 4] and
B # is of size [4 x 10]
then,
result = torch.mm(A.view(-1, 4), B) # is of size [1280 x 10] = [12800]
which cannot be rewritten as a tensor of size [1 x 10 x 128] = [1280].
Sometimes a small recap of the basics 172 helps!