Pecot:

Would this multiplication of the linear output in the ModuleList be forbidden? I don’t think so. I don’t know how to solve this problem.


Yes, the modification in self.linears is creating the error.
The first layer will output an activation in the shape [batch_size, 14*3], while the next one expects an input of the shape [batch_size, 14], which fits the error message you’ve posted.



 Pecot:

The pattern seems correct to me. Each linear of the input takes 14 values at the input and a (14*3) = 42 values at the output.


Since the layers are applied sequentially, you would have to make sure that the output size of one layer fits the expected input shape of the next one.