Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
2aec950c
Unverified
Commit
2aec950c
authored
Aug 30, 2018
by
Mark Daoust
Committed by
GitHub
Aug 30, 2018
Browse files
Merge pull request #5058 from raymond-yuan/patch-1
minor bug fix
parents
d988d710
e9dbef6b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
research/a3c_blogpost/a3c_cartpole.py
research/a3c_blogpost/a3c_cartpole.py
+3
-5
No files found.
research/a3c_blogpost/a3c_cartpole.py
View file @
2aec950c
...
...
@@ -347,12 +347,10 @@ class Worker(threading.Thread):
value_loss
=
advantage
**
2
# Calculate our policy loss
actions_one_hot
=
tf
.
one_hot
(
memory
.
actions
,
self
.
action_size
,
dtype
=
tf
.
float32
)
policy
=
tf
.
nn
.
softmax
(
logits
)
entropy
=
tf
.
reduce_sum
(
policy
*
tf
.
log
(
policy
+
1e-20
),
axis
=
1
)
entropy
=
tf
.
nn
.
softmax_cross_entropy_with_logits_v2
(
labels
=
policy
,
logits
=
logits
)
policy_loss
=
tf
.
nn
.
softmax_cross_entropy_with_logits
_v2
(
labels
=
actions
_one_hot
,
policy_loss
=
tf
.
nn
.
sparse_
softmax_cross_entropy_with_logits
(
labels
=
memory
.
actions
,
logits
=
logits
)
policy_loss
*=
tf
.
stop_gradient
(
advantage
)
policy_loss
-=
0.01
*
entropy
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment