The clipped surrogate is the heart of PPO. Each sample contributes the smaller of the raw and clipped weighted advantage, and the batch objective is their average.
Implement ppo_objective(ratios, advantages, eps), the batch mean of the element-wise clipped minimum.
eps is the clip range, typically 0.2.Compute ratios * advantages and clip(ratios) * advantages, take the element-wise minimum, then average.
No results yet
Run your code to check it against the examples, or submit to run every test.