I believe this is due to the dimensions of the tensors in the linear calculation – c.view(c.size(0),-1) looks to be instantiating a (1x256 tensor) tensor. If you want to keep the input_size, hidden_size as 3 and 256 respectively, you will need to modify the view function so that the tensor is (256x1)