tf_agents.environments.parallel_py_environment.ProcessPyEnvironment
Stay organized with collections
Save and categorize content based on your preferences.
Step a single env in a separate process for lock free paralellism.
tf_agents.environments.parallel_py_environment.ProcessPyEnvironment(
env_constructor: tf_agents.environments.parallel_py_environment.EnvConstructor
,
flatten: bool = False
)
Args |
env_constructor
|
Callable that creates and returns a Python environment.
|
flatten
|
Boolean, whether to assume flattened actions and time_steps
during communication to avoid overhead.
|
Methods
access
View source
access(
name: Text
) -> Any
Access an attribute of the external environment.
This method blocks.
Args |
name
|
Name of the attribute to access.
|
Returns |
The attribute value.
|
action_spec
View source
action_spec() -> tf_agents.typing.types.NestedArraySpec
call
View source
call(
name: Text, *args, **kwargs
) -> tf_agents.environments.parallel_py_environment.Promise
Asynchronously call a method of the external environment.
Args |
name
|
Name of the method to call.
|
*args
|
Positional arguments to forward to the method.
|
**kwargs
|
Keyword arguments to forward to the method.
|
close
View source
close() -> None
Send a close message to the external process and join it.
observation_spec
View source
observation_spec() -> tf_agents.typing.types.NestedArraySpec
render
View source
render(
mode: Text = 'rgb_array', blocking: bool = True
) -> Union[types.NestedArray, Promise]
Renders the environment.
Args |
mode
|
Rendering mode. Only 'rgb_array' is supported.
|
blocking
|
Whether to wait for the result.
|
Returns |
An ndarray of shape [width, height, 3] denoting an RGB image when
blocking. Otherwise, callable that returns the rendered image.
|
Raises |
NotImplementedError
|
If the environment does not support rendering,
or any other modes than rgb_array is given.
|
reset
View source
reset(
blocking: bool = True
) -> Union[tf_agents.trajectories.TimeStep
, tf_agents.environments.parallel_py_environment.Promise
]
Reset the environment.
Args |
blocking
|
Whether to wait for the result.
|
Returns |
New observation when blocking, otherwise callable that returns the new
observation.
|
start
View source
start(
wait_to_start: bool = True
) -> None
Start the process.
Args |
wait_to_start
|
Whether the call should wait for an env initialization.
|
step
View source
step(
action: tf_agents.typing.types.NestedArray
,
blocking: bool = True
) -> Union[tf_agents.trajectories.TimeStep
, tf_agents.environments.parallel_py_environment.Promise
]
Step the environment.
Args |
action
|
The action to apply to the environment.
|
blocking
|
Whether to wait for the result.
|
Returns |
time step when blocking, otherwise callable that returns the time step.
|
time_step_spec
View source
time_step_spec() -> tf_agents.trajectories.TimeStep
wait_start
View source
wait_start() -> None
Wait for the started process to finish initialization.
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."],[],[]]