What is the order of the hidden and cell states in the tuple that is returned by LSTM? Particularly, in the word LM model, in generate.py
, we have:
with open(args.outf, 'w') as outf:
with torch.no_grad(): # no tracking history
for i in range(args.words):
output, hidden = model(input, hidden)
....
......
In the above code, hidden
is a tuple with two tensors, each of same shape. Since this is an LSTM, it returns both h
and c
states. But, how is h
and c
ordered in the tuple?
My understanding is this:
h, c = hidden
Is this correct? Or is it the other way around?
Thanks!