Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
edit advantage in surrogate
  • Loading branch information
AlpoGIT authored Apr 9, 2019
commit 875762fd7cc74ce5c349a52362db5adfbb8818e9
2 changes: 1 addition & 1 deletion PPO_continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def update(self, memory):
# Finding Surrogate Loss:
advantages = rewards - state_values.detach()
surr1 = ratios * advantages
surr2 = torch.clamp(ratios, 1-self.eps_clip, 1+self.eps_clip)
surr2 = torch.clamp(ratios, 1-self.eps_clip, 1+self.eps_clip) * advantages
loss = -torch.min(surr1, surr2) + 0.5*self.MseLoss(state_values, rewards) - 0.01*dist_entropy

# take gradient step
Expand Down