Skip to content

Commit

Permalink
fix: minor updates to strings and change .all to .any.
Browse files Browse the repository at this point in the history
  • Loading branch information
KaleabTessera committed Dec 15, 2023
1 parent ab9bcce commit 8f1d10d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions supersuit/utils/agent_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def change_observation(obs, space, indicator_data):
if ndims == 1:
old_len = len(obs)
new_obs = np.pad(obs, (0, num_indicators))
# if we have a finite high, use that, otherwise use 1.0 as agent indicator
if not np.isinf(space.high).all():
# if all spaces are finite, use the max, otherwise use 1.0 as agent indicator
if not np.isinf(space.high).any():
new_obs[indicator_num + old_len] = np.max(space.high)
else:
new_obs[indicator_num + old_len] = 1.0
Expand All @@ -88,9 +88,9 @@ def change_observation(obs, space, indicator_data):
obs = obs if ndims == 3 else np.expand_dims(obs, 2)
old_shaped3 = obs.shape[2]
new_obs = np.pad(obs, [(0, 0), (0, 0), (0, num_indicators)])
# if we have a finite high, use that, otherwise use 1.0 as agent indicator
if not np.isinf(space.high).all():
new_obs[:, :, old_shaped3 + indicator_num] = np.min(space.high)
# if all spaces are finite, use the max, otherwise use 1.0 as agent indicator
if not np.isinf(space.high).any():
new_obs[:, :, old_shaped3 + indicator_num] = np.max(space.high)
else:
new_obs[:, :, old_shaped3 + indicator_num] = 1.0
return new_obs
Expand Down

0 comments on commit 8f1d10d

Please sign in to comment.