Skip to content

Commit

Permalink
Add type error suppressions for upcoming upgrade
Browse files Browse the repository at this point in the history
Reviewed By: MaggieMoss

Differential Revision: D64504587

fbshipit-source-id: 858e286f35a865e0a18d87d9b512c89d665bdeb0
  • Loading branch information
generatedunixname89002005307016 authored and facebook-github-bot committed Oct 17, 2024
1 parent c061b43 commit dfa4c54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pearl/utils/instantiations/spaces/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def __init__(
seed: Random seed used to initialize the random number generator of the
underlying Gymnasium `Box` space.
"""
# pyre-fixme[9]: low has type `Union[float, Tensor]`; used as `ndarray[Any,
# Any]`.
low = low.numpy(force=True) if isinstance(low, Tensor) else np.array([low])
# pyre-fixme[9]: high has type `Union[float, Tensor]`; used as `ndarray[Any,
# Any]`.
high = high.numpy(force=True) if isinstance(high, Tensor) else np.array([high])
self._gym_space = Box(low=low, high=high, seed=seed)

Expand Down
4 changes: 4 additions & 0 deletions pearl/utils/instantiations/spaces/box_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ def __init__(
seed: Random seed used to initialize the random number generator of the
underlying Gymnasium `Box` space.
"""
# pyre-fixme[9]: low has type `Union[float, Tensor]`; used as `ndarray[Any,
# Any]`.
low = (
reshape_to_1d_tensor(low).numpy(force=True)
if isinstance(low, Tensor)
else np.array([low])
)
# pyre-fixme[9]: high has type `Union[float, Tensor]`; used as `ndarray[Any,
# Any]`.
high = (
reshape_to_1d_tensor(high).numpy(force=True)
if isinstance(high, Tensor)
Expand Down

0 comments on commit dfa4c54

Please sign in to comment.