diff --git a/12_2_hello_rnn.py b/12_2_hello_rnn.py index c0364e3..257fa41 100644 --- a/12_2_hello_rnn.py +++ b/12_2_hello_rnn.py @@ -75,7 +75,7 @@ def init_hidden(self): hidden, output = model(hidden, input) val, idx = output.max(1) sys.stdout.write(idx2char[idx.data[0]]) - loss += criterion(output, label) + loss += criterion(output, label.view(1)) print(", epoch: %d, loss: %1.3f" % (epoch + 1, loss.data[0]))