Skip to content

Commit

Permalink
Fix RescaleObservation on Windows (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed May 28, 2024
1 parent 7ac7b29 commit 6c315e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gymnasium/wrappers/transform_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,14 @@ def __init__(
self.max_obs = max_obs

# Imagine the x-axis between the old Box and the y-axis being the new Box
# float128 is not available everywhere
try:
high_low_diff_dtype = np.float128
except AttributeError:
high_low_diff_dtype = np.float64
high_low_diff = np.array(
env.observation_space.high, dtype=np.float128
) - np.array(env.observation_space.low, dtype=np.float128)
env.observation_space.high, dtype=high_low_diff_dtype
) - np.array(env.observation_space.low, dtype=high_low_diff_dtype)
gradient = np.array(
(max_obs - min_obs) / high_low_diff, dtype=env.observation_space.dtype
)
Expand Down

0 comments on commit 6c315e9

Please sign in to comment.