Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detach z star p. #13

Merged
merged 1 commit into from
Jul 7, 2018
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
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _trust_region_loss(model, distribution, ref_distribution, loss, threshold):
z_star = [g_p - trust_factor.expand_as(k_p) * k_p for g_p, k_p in zip(g, k)]
trust_loss = 0
for param, z_star_p in zip([model.fc_actor.weight, model.fc_actor.bias], z_star):
trust_loss += (param * z_star_p).sum()
trust_loss += (param * z_star_p.detach()).sum()
_isolate_policy_grads(model, False) # Re-enable gradients for other parameters
return trust_loss

Expand Down