Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dipam Chakraborty
neurips-2020-procgen-competition
Commits
4274e56a
Commit
4274e56a
authored
Oct 20, 2020
by
Dipam Chakraborty
Browse files
dist fix
parent
2f2c6b78
Changes
1
Hide whitespace changes
Inline
Side-by-side
algorithms/custom_ppg/custom_torch_ppg.py
View file @
4274e56a
...
...
@@ -93,8 +93,7 @@ class CustomTorchPolicy(TorchPolicy):
self
.
ent_coef
=
config
[
'entropy_coeff'
]
self
.
last_dones
=
np
.
zeros
((
nw
*
self
.
config
[
'num_envs_per_worker'
],))
# self.make_distr = dist_build(action_space)
self
.
make_distr
=
dist_class
self
.
make_distr
=
dist_build
(
action_space
)
self
.
retunes_completed
=
0
def
to_tensor
(
self
,
arr
):
...
...
@@ -221,7 +220,7 @@ class CustomTorchPolicy(TorchPolicy):
g
[
'lr'
]
=
lr
vpred
,
pi_logits
=
self
.
model
.
vf_pi
(
obs
,
ret_numpy
=
False
,
no_grad
=
False
,
to_torch
=
False
)
pd
=
self
.
make_distr
(
pi_logits
)
logp_actions
=
pd
.
log
p
(
actions
[...,
None
]).
squeeze
(
1
)
logp_actions
=
pd
.
log
_prob
(
actions
[...,
None
]).
squeeze
(
1
)
entropy
=
torch
.
mean
(
pd
.
entropy
())
vf_loss
=
.
5
*
torch
.
mean
(
torch
.
pow
((
vpred
-
returns
),
2
))
*
vf_coef
...
...
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