RuntimeError: invalid argument 2: view size is not compatible with input tensor's size and stride

I’m running a basic LTSM forward unit and getting this error.

from torch.nn import LSTM, GRU

lstm_class = LSTM(input_size= 1024,
                        hidden_size = 300,
                        num_layers= 2,
                        bidirectional = True,
                        batch_first = True,
                        dropout = 0.)

inputs = torch.zeros((16,4,1024))

Then running this line gives me the error:
lstm_class(inputs)

RuntimeError: invalid argument 2: view size is not compatible with input tensor’s size and stride (at least one dimension spans across two contiguous subspaces). Call .contiguous() before .view(). at /pytorch/aten/src/TH/generic/THTensor.cpp:237

torch.__version__ = '0.4.1'
Python version = 3.6.6
torch.cuda.is_available() = True

Why don’t it happen to me?

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 18:21:58) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> lstm = torch.nn.LSTM(input_size=1024,hidden_size=300,num_layers=2,bidirectional=True,batch_first=True)
>>> ip = torch.zeros(16, 4, 1024)
>>> hidden, state = lstm(ip)
>>> hidden.shape
torch.Size([16, 4, 600])
>>> state[0].shape
torch.Size([4, 16, 300])
>>> 

>>> torch.__version__
'0.4.0'
>>> torch.cuda.is_available()
True