class_docstr: Exposes a Python policy as an in-graph TensorFlow policy.
  
  # TODO(kbanoop): This class does not seem to handle batching/unbatching when
  # converting between TF and Py policies.
class_docstr_tok: ["Exposes","a","Python","policy","as","an","in-graph","TensorFlow","policy",".","#","TODO","(","kbanoop",")",":","This","class","does","not","seem","to","handle","batching\/unbatching","when","#","converting","between","TF","and","Py","policies","."]
docstr: Invokes  python policy reset through numpy_function.
  
  Args:
    batch_size: Batch size for the get_initial_state tensor(s).
  
  Returns:
    A tuple of (policy_state, reset_op).
    policy_state: Tensor, or a nested dict, list or tuple of Tensors,
    representing the new policy state.
    reset_op: a list of Tensors representing the results of py_policy.reset().
docstr_tok: ["Invokes","python","policy","reset","through","numpy_function",".","Args",":","batch_size",":","Batch","size","for","the","get_initial_state","tensor","(","s",")",".","Returns",":","A","tuple","of","(","policy_state",",","reset_op",")",".","policy_state",":","Tensor",",","or","a","nested","dict",",","list","or","tuple","of","Tensors",",","representing","the","new","policy","state",".","reset_op",":","a","list","of","Tensors","representing","the","results","of","py_policy.reset","(",")","."]
code: def _get_initial_state(self, batch_size):
      """Invokes  python policy reset through numpy_function.
  
      Args:
        batch_size: Batch size for the get_initial_state tensor(s).
  
      Returns:
        A tuple of (policy_state, reset_op).
        policy_state: Tensor, or a nested dict, list or tuple of Tensors,
        representing the new policy state.
        reset_op: a list of Tensors representing the results of py_policy.reset().
      """
  
      def _get_initial_state_fn(*batch_size):
          return tf.nest.flatten(
              self._py_policy.get_initial_state(batch_size=batch_size)
          )
  
      with tf.name_scope("get_initial_state"):
          flat_policy_state = tf.numpy_function(
              _get_initial_state_fn,
              [batch_size],
              self._policy_state_dtypes,
              name="get_initial_state_numpy_function",
          )
          return tf.nest.pack_sequence_as(
              structure=self.policy_state_spec,
              flat_sequence=flat_policy_state,
          )
  
file_path: agents/tf_agents/policies/tf_py_policy.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional, Text
  import tensorflow
  from tf_agents.policies import py_policy
  from tf_agents.policies import tf_policy
  from tf_agents.specs import tensor_spec
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 2 for calling the TFPyPolicy obj's underlying member method code with example usage: obj._get_initial_state(batch_size) and returns: tf, tf