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