fix typo
This commit is contained in:
@ -82,7 +82,7 @@ for step in range(100):
|
|||||||
# !! next step is important !!
|
# !! next step is important !!
|
||||||
h_state = h_state.data # repack the hidden state, break the connection from last iteration
|
h_state = h_state.data # repack the hidden state, break the connection from last iteration
|
||||||
|
|
||||||
loss = loss_func(prediction, y) # cross entropy loss
|
loss = loss_func(prediction, y) # calculate loss
|
||||||
optimizer.zero_grad() # clear gradients for this training step
|
optimizer.zero_grad() # clear gradients for this training step
|
||||||
loss.backward() # backpropagation, compute gradients
|
loss.backward() # backpropagation, compute gradients
|
||||||
optimizer.step() # apply gradients
|
optimizer.step() # apply gradients
|
||||||
|
|||||||
Reference in New Issue
Block a user