Skip to content

Commit

Permalink
[RLlib] Issue 21109: Action unsquashing causes inf/NaN actions for un…
Browse files Browse the repository at this point in the history
…bounded action spaces. (#21110)
  • Loading branch information
sven1977 authored Jan 10, 2022
1 parent b10d553 commit 35af30a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rllib/utils/spaces/space_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ def unsquash_action(action, action_space_struct):

def map_(a, s):
if isinstance(s, gym.spaces.Box) and \
(s.dtype == np.float32 or s.dtype == np.float64):
(s.dtype == np.float32 or s.dtype == np.float64) and \
np.all(s.bounded_below) and np.all(s.bounded_above):
# Assuming values are roughly between -1.0 and 1.0 ->
# unsquash them to the given bounds.
a = s.low + (a + 1.0) * (s.high - s.low) / 2.0
Expand Down

0 comments on commit 35af30a

Please sign in to comment.