class_docstr: Exposes a Python environment as an in-graph TF environment.
  
  This class supports Python environments that return nests of arrays as
  observations and accept nests of arrays as actions. The nest structure is
  reflected in the in-graph environment's observation and action structure.
  
  Implementation notes:
  
  * Since `tf.py_func` deals in lists of tensors, this class has some additional
    `tf.nest.flatten` and `tf.nest.pack_structure_as` calls.
  
  * This class currently cast rewards and discount to float32.
class_docstr_tok: ["Exposes","a","Python","environment","as","an","in-graph","TF","environment",".","This","class","supports","Python","environments","that","return","nests","of","arrays","as","observations","and","accept","nests","of","arrays","as","actions",".","The","nest","structure","is","reflected","in","the","in-graph","environment","'s","observation","and","action","structure",".","Implementation","notes",":","*","Since","`","tf.py_func","`","deals","in","lists","of","tensors",",","this","class","has","some","additional","`","tf.nest.flatten","`","and","`","tf.nest.pack_structure_as","`","calls",".","*","This","class","currently","cast","rewards","and","discount","to","float32","."]
code: def _execute(self, fn, *args, **kwargs):
      if not self._pool:
          return fn(*args, **kwargs)
      return self._pool.apply(fn, args=args, kwds=kwargs)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  from multiprocessing import pool
  import threading
  from typing import Any, Optional, Text
  from absl import logging
  import gin
  import numpy
  import tensorflow
  from tf_agents.environments import batched_py_environment
  from tf_agents.environments import py_environment
  from tf_agents.environments import tf_environment
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
  from tensorflow.python.framework import tensor_shape
label_desc: Use image node_id 5 for calling the TFPyEnvironment obj's underlying member method code with example usage: obj._execute(fn) and returns: self, fn