Skip to content

Commit

Permalink
fixing loss (pytorch#1420)
Browse files Browse the repository at this point in the history
Co-authored-by: holly1238 <77758406+holly1238@users.noreply.github.com>
  • Loading branch information
Juphex and holly1238 committed Apr 26, 2021
1 parent f1fd16f commit 8dfdda4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion intermediate_source/reinforcement_q_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ def optimize_model():
expected_state_action_values = (next_state_values * GAMMA) + reward_batch

# Compute Huber loss
loss = F.smooth_l1_loss(state_action_values, expected_state_action_values.unsqueeze(1))
criterion = nn.SmoothL1Loss()
loss = criterion(state_action_values, expected_state_action_values.unsqueeze(1))

# Optimize the model
optimizer.zero_grad()
Expand Down

0 comments on commit 8dfdda4

Please sign in to comment.