My code:
class LSTMModel(nn.Module):
def init(self):
super(LSTMModel, self).init()
self.LSTM = nn.LSTM(input_size=input_size, hidden_size=hidden_size,
batch_first=True)
def forward(self ,x, hidden, cell):
    x = x.view(batch_size, sequence_length, input_size)
    out, (hidden, cell)= self.LSTM(x, hidden, cell)
    out= out.view(-1, num_classes)
    return out,hidden,cell
def init_hidden(self):
    return Variable(torch.zeros(num_layers, batch_size, hidden_size))

model = LSTMModel()
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=0.1)
for epoch in range(100):
optimizer.zero_grad()
loss = 0
hidden = model.init_hidden()
cell = model.init_hidden()
print(“Predicted String”)
for ins, label in zip(inputs,labels):
output,hidden,cell = model(ins,hidden,cell)
val, idx = output.max(1)
print(idx2char[idx.data[0]])
loss+=criterion(output, label.unsqueeze(0))
print(", epoch: %d, loss: %1.3f" % (epoch+1, loss.data[0]))

loss.backward()
optimizer.step()

Predicted String
Traceback (most recent call last):
File “”, line 1, in 
runfile(‘E:/Python Deep Learnig Projects/Code/Section_3/seqtest.py’, wdir=‘E:/Python Deep Learnig Projects/Code/Section_3’)
File “C:\Users\admin\Miniconda3\envs\tensorflow\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 827, in runfile
execfile(filename, namespace)
File “C:\Users\admin\Miniconda3\envs\tensorflow\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 110, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)
File “E:/Python Deep Learnig Projects/Code/Section_3/seqtest.py”, line 62, in 
output,hidden,cell = model(ins,hidden,cell)
File “C:\Users\admin\Miniconda3\envs\tensorflow\lib\site-packages\torch\nn\modules\module.py”, line 532, in call
result = self.forward(*input, **kwargs)
File “E:/Python Deep Learnig Projects/Code/Section_3/seqtest.py”, line 45, in forward
out, (hidden, cell)= self.LSTM(x, hidden, cell)
File “C:\Users\admin\Miniconda3\envs\tensorflow\lib\site-packages\torch\nn\modules\module.py”, line 532, in call
result = self.forward(*input, **kwargs)
TypeError: forward() takes from 2 to 3 positional arguments but 4 were given