tf_agents.environments.gym_wrapper.spec_from_gym_space
Stay organized with collections
Save and categorize content based on your preferences.
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.
Args |
space
|
gym.Space to turn into a spec.
|
dtype_map
|
A dict from spaces to dtypes to use as the default dtype.
|
simplify_box_bounds
|
Whether to replace bounds of Box space that are arrays
with identical values with one number and rely on broadcasting.
|
name
|
Name of the spec.
|
Returns |
A BoundedArraySpec nest mirroring the given space structure.
|
Raises |
ValueError
|
If there is an unknown space type.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]