Skip to content

Commit

Permalink
fixed wrong comment
Browse files Browse the repository at this point in the history
  • Loading branch information
graykode committed May 14, 2019
1 parent 664bf08 commit 3b3a80d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 4-1.Seq2Seq/Seq2Seq-Torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def forward(self, enc_input, enc_hidden, dec_input):
# output_batch : [batch_size, max_len+1(=n_step, time step) (becase of 'S' or 'E'), n_class]
# target_batch : [batch_size, max_len+1(=n_step, time step)], not one-hot
output = model(input_batch, hidden, output_batch)
# output : [max_len+1, batch_size, num_directions(=1) * n_hidden]
output = output.transpose(0, 1) # [batch_size, max_len+1(=6), num_directions(=1) * n_hidden]
# output : [max_len+1, batch_size, n_class]
output = output.transpose(0, 1) # [batch_size, max_len+1(=6), n_class]
loss = 0
for i in range(0, len(target_batch)):
# output[i] : [max_len+1, num_directions(=1) * n_hidden, target_batch[i] : max_len+1]
# output[i] : [max_len+1, n_class, target_batch[i] : max_len+1]
loss += criterion(output[i], target_batch[i])
if (epoch + 1) % 1000 == 0:
print('Epoch:', '%04d' % (epoch + 1), 'cost =', '{:.6f}'.format(loss))
Expand Down

0 comments on commit 3b3a80d

Please sign in to comment.