In general can I use sequence length in a normal rnn input instead of calculating the loss in a loop.
Following is the code snipet :
for i in range(input_line_tensor.size(0)): output, hidden = rnn(category_tensor, input_line_tensor[i], hidden) l = criterion(output, target_line_tensor[i]) loss += l
The author in order to learn the temporal sequence between characters calculates loss by feeding each at a one timestep.
My question is as rnn pytorch docs define input as :
input of shape (seq_len, batch, input_size): tensor containing the features of the input sequence.
would I get the same result in terms of loss if the above entire sequence was passed in a single matrix rather than in a for loop.