View source on GitHub |
Converts gym spaces into array specs.
tf_agents.environments.gym_wrapper.spec_from_gym_space(
space: gym.Space,
dtype_map: Optional[Dict[gym.Space, np.dtype]] = None,
simplify_box_bounds: bool = True,
name: Optional[Text] = None
) -> tf_agents.specs.BoundedArraySpec
Gym does not properly define dtypes for spaces. By default all spaces set their type to float64 even though observations do not always return this type. See: https://github.com/openai/gym/issues/527
To handle this we allow a dtype_map for setting default types for mapping spaces to specs.
observations. Not sure that we have a need for this yet.
Returns | |
---|---|
A BoundedArraySpec nest mirroring the given space structure. |
Raises | |
---|---|
ValueError
|
If there is an unknown space type. |