Hi,
thanks for your reply.
I solved using TensorDataset and DataLoader:
train_tensor = torch.utils.data.TensorDataset(X_train,y_train)
train_loader = torch.utils.data.DataLoader(dataset = train_tensor, batch_size = 1)

Now the loop looks like this:
hist = np.zeros(10)
lstm = []
for t in range(num_epochs):
    for batch_idx, (inputs, targets) in enumerate(train_loader):
         #model.zero_grad()
         optimiser.zero_grad()
         y_train_pred = model(inputs)    

         loss = criterion(y_train_pred.reshape(1), targets.reshape(1))
         loss.backward()
         optimiser.step()
    print("Epoch ", t, "MSE: ", loss.item())
    hist[t] = loss.item()

However, the result looks a bit different but it still does not learn:
Epoch  0 MSE:  1.0
Epoch  1 MSE:  1.0
Epoch  2 MSE:  1.0
Epoch  3 MSE:  1.0
Epoch  4 MSE:  1.0
Epoch  5 MSE:  1.0
Epoch  6 MSE:  1.0
Epoch  7 MSE:  1.0
Epoch  8 MSE:  1.0
Epoch  9 MSE:  1.0

I can only imagine that dataset shape is not appropriate or something in the model.
Do you have any idea?
Thanks