Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AdvRL19
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flgw
AdvRL19
Commits
d2dedd10
Commit
d2dedd10
authored
Nov 7, 2018
by
Kate Rakelly
Browse files
Options
Downloads
Patches
Plain Diff
HW5c fix: critic arch should match policy
also remove debugging print statement
parent
ee7e7a46
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
hw5/meta/train_policy.py
+1
-2
1 addition, 2 deletions
hw5/meta/train_policy.py
with
1 addition
and
2 deletions
hw5/meta/train_policy.py
+
1
−
2
View file @
d2dedd10
...
@@ -308,7 +308,7 @@ class Agent(object):
...
@@ -308,7 +308,7 @@ class Agent(object):
# PPO critic update
# PPO critic update
critic_regularizer
=
tf
.
contrib
.
layers
.
l2_regularizer
(
1e-3
)
if
self
.
l2reg
else
None
critic_regularizer
=
tf
.
contrib
.
layers
.
l2_regularizer
(
1e-3
)
if
self
.
l2reg
else
None
self
.
critic_prediction
=
tf
.
squeeze
(
build_critic
(
self
.
sy_ob_no
,
self
.
sy_hidden
,
1
,
'
critic_network
'
,
n_layers
=
self
.
n_layers
,
size
=
self
.
size
,
gru_size
=
self
.
gru_size
,
regularizer
=
critic_regularizer
))
self
.
critic_prediction
=
tf
.
squeeze
(
build_critic
(
self
.
sy_ob_no
,
self
.
sy_hidden
,
1
,
'
critic_network
'
,
n_layers
=
self
.
n_layers
,
size
=
self
.
size
,
gru_size
=
self
.
gru_size
,
recurrent
=
self
.
recurrent
,
regularizer
=
critic_regularizer
))
self
.
sy_target_n
=
tf
.
placeholder
(
shape
=
[
None
],
name
=
"
critic_target
"
,
dtype
=
tf
.
float32
)
self
.
sy_target_n
=
tf
.
placeholder
(
shape
=
[
None
],
name
=
"
critic_target
"
,
dtype
=
tf
.
float32
)
self
.
critic_loss
=
tf
.
losses
.
mean_squared_error
(
self
.
sy_target_n
,
self
.
critic_prediction
)
self
.
critic_loss
=
tf
.
losses
.
mean_squared_error
(
self
.
sy_target_n
,
self
.
critic_prediction
)
self
.
critic_weights
=
tf
.
get_collection
(
tf
.
GraphKeys
.
GLOBAL_VARIABLES
,
scope
=
'
critic_network
'
)
self
.
critic_weights
=
tf
.
get_collection
(
tf
.
GraphKeys
.
GLOBAL_VARIABLES
,
scope
=
'
critic_network
'
)
...
@@ -715,7 +715,6 @@ def train_PG(
...
@@ -715,7 +715,6 @@ def train_PG(
log_probs
=
agent
.
sess
.
run
(
agent
.
sy_lp_n
,
log_probs
=
agent
.
sess
.
run
(
agent
.
sy_lp_n
,
feed_dict
=
{
agent
.
sy_ob_no
:
ob_no
,
agent
.
sy_hidden
:
hidden
,
agent
.
sy_ac_na
:
ac_na
})
feed_dict
=
{
agent
.
sy_ob_no
:
ob_no
,
agent
.
sy_hidden
:
hidden
,
agent
.
sy_ac_na
:
ac_na
})
print
(
'
new log prob
'
,
log_probs
.
shape
)
agent
.
update_parameters
(
ob_no
,
hidden
,
ac_na
,
fixed_log_probs
,
q_n
,
adv_n
)
agent
.
update_parameters
(
ob_no
,
hidden
,
ac_na
,
fixed_log_probs
,
q_n
,
adv_n
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment