I’ve been trying to get an LSTM working, and have been looking off the docs and a couple examples but I keep getting a ‘tuple’ object has no attribute ‘size’ error when I call the model at

```
output, hidden = model((inp[s,:,:], (initial_hidden, initial_cell)))
```

I can’t figure out whats causing the error, here’s what I have so far:

```
model = torch.nn.Sequential(
nn.LSTM(input_size = input_size, hidden_size = hidden_size, num_layers = num_layers, dropout = dropout),
nn.Linear(hidden_size, input_size)
)
initial_hidden = Variable(torch.zeros(num_layers, 1, hidden_size))
initial_cell = Variable(torch.zeros(num_layers, 1, hidden_size))
loss_function = nn.CrossEntropyLoss()
model_optimizer = torch.optim.Adam(model.parameters(), lr = learning_rate)
for i in range(int(np.shape(data)[0] / seq_length)):
model.zero_grad()
loss = 0
inp = data[int(i * seq_length) : int((i * seq_length) + seq_length - 2), :, :]
target = data[int((i * seq_length) + 1) : int((i * seq_length) + seq_length - 1), :, :]
for s in range(seq_length):
output, hidden = model((inp[s,:,:], (initial_hidden, initial_cell)))
loss += loss_function(output, target[s,:,:])
loss.backward()
model_optimizer.step()
```

Thank you!