Skip to content

Commit

Permalink
[RLlib] Fix gym.spaces.Box receiving TensorDims from RLlib as shape (…
Browse files Browse the repository at this point in the history
…instead or list of ints). (#28334)
  • Loading branch information
sven1977 authored Sep 8, 2022
1 parent 2cdec9d commit acda25d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rllib/policy/dynamic_tf_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,10 @@ def _initialize_loss_from_dummy_batch(
logger.info("Adding extra-action-fetch `{}` to view-reqs.".format(key))
self.view_requirements[key] = ViewRequirement(
space=gym.spaces.Box(
-1.0, 1.0, shape=value.shape[1:], dtype=value.dtype.name
-1.0,
1.0,
shape=value.shape.as_list()[1:],
dtype=value.dtype.name,
),
used_for_compute_actions=False,
)
Expand Down
5 changes: 4 additions & 1 deletion rllib/policy/dynamic_tf_policy_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,10 @@ def _initialize_loss_from_dummy_batch(
logger.info("Adding extra-action-fetch `{}` to view-reqs.".format(key))
self.view_requirements[key] = ViewRequirement(
space=gym.spaces.Box(
-1.0, 1.0, shape=value.shape[1:], dtype=value.dtype.name
-1.0,
1.0,
shape=value.shape.as_list()[1:],
dtype=value.dtype.name,
),
used_for_compute_actions=False,
)
Expand Down

0 comments on commit acda25d

Please sign in to comment.