Solved by gfrogat in post #2 
              
              
                Hi 
You can change the shape using torch.Tensor.view: 
out = self.DropoutLayer(out)
out = out.view(out.size(0), -1)
out = self.FullyConnected(out)