class_docstr: Step a single env in a separate process for lock free paralellism.
class_docstr_tok: ["Step","a","single","env","in","a","separate","process","for","lock","free","paralellism","."]
docstr: Step environment in a separate process for lock free paralellism.
  
  The environment is created in an external process by calling the provided
  callable. This can be an environment class, or a function creating the
  environment and potentially wrapping it. The returned environment should
  not access global variables.
  
  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.
  
  Attributes:
    observation_spec: The cached observation spec of the environment.
    action_spec: The cached action spec of the environment.
    time_step_spec: The cached time step spec of the environment.
docstr_tok: ["Step","environment","in","a","separate","process","for","lock","free","paralellism",".","The","environment","is","created","in","an","external","process","by","calling","the","provided","callable",".","This","can","be","an","environment","class",",","or","a","function","creating","the","environment","and","potentially","wrapping","it",".","The","returned","environment","should","not","access","global","variables",".","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",".","Attributes",":","observation_spec",":","The","cached","observation","spec","of","the","environment",".","action_spec",":","The","cached","action","spec","of","the","environment",".","time_step_spec",":","The","cached","time","step","spec","of","the","environment","."]
code: def __init__(
      self, env_constructor: EnvConstructor, flatten: bool = False
  ):
      """Step environment in a separate process for lock free paralellism.
  
      The environment is created in an external process by calling the provided
      callable. This can be an environment class, or a function creating the
      environment and potentially wrapping it. The returned environment should
      not access global variables.
  
      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.
  
      Attributes:
        observation_spec: The cached observation spec of the environment.
        action_spec: The cached action spec of the environment.
        time_step_spec: The cached time step spec of the environment.
      """
      # NOTE(ebrevdo): multiprocessing uses the standard py3 pickler which does
      # not support anonymous lambdas.  Folks usually pass anonymous lambdas as
      # env constructors.  Here we work around this by manually pickling
      # the constructor using cloudpickle; which supports these.  In the
      # new process, we'll unpickle this constructor and run it.
      self._pickled_env_constructor = cloudpickle.dumps(env_constructor)
      self._flatten = flatten
      self._observation_spec = None
      self._action_spec = None
      self._time_step_spec = None
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import atexit
  import sys
  import traceback
  from typing import Any, Callable, Sequence, Text, Union
  from absl import logging
  import cloudpickle
  import gin
  import numpy
  import tensorflow
  from tf_agents.environments import py_environment
  from tf_agents.system import system_multiprocessing
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new ProcessPyEnvironment object from inherited base classes: object with example: obj = ProcessPyEnvironment(env_constructor, flatten)