class_docstr: Batch together multiple py policies and act as a single batch.
  
  The policies should only access shared python variables using
  shared mutex locks (from the threading module).
class_docstr_tok: ["Batch","together","multiple","py","policies","and","act","as","a","single","batch",".","The","policies","should","only","access","shared","python","variables","using","shared","mutex","locks","(","from","the","threading","module",")","."]
docstr: Forward a batch of time_step and policy_states to the wrapped policies.
  
  Args:
    time_step: A `TimeStep` tuple corresponding to `time_step_spec()`.
    policy_state: An Array, or a nested dict, list or tuple of Arrays
      representing the previous policy_state.
    seed: Seed value used to initialize a pseudorandom number generator.
  
  Returns:
    A batch of `PolicyStep` named tuples, each one containing:
      `action`: A nest of action Arrays matching the `action_spec()`.
      `state`: A nest of policy states to be fed into the next call to action.
      `info`: Optional side information such as action log probabilities.
  
  Raises:
    NotImplementedError: if `seed` is not None.
docstr_tok: ["Forward","a","batch","of","time_step","and","policy_states","to","the","wrapped","policies",".","Args",":","time_step",":","A","`","TimeStep","`","tuple","corresponding","to","`","time_step_spec","(",")","`",".","policy_state",":","An","Array",",","or","a","nested","dict",",","list","or","tuple","of","Arrays","representing","the","previous","policy_state",".","seed",":","Seed","value","used","to","initialize","a","pseudorandom","number","generator",".","Returns",":","A","batch","of","`","PolicyStep","`","named","tuples",",","each","one","containing",":","`","action","`",":","A","nest","of","action","Arrays","matching","the","`","action_spec","(",")","`",".","`","state","`",":","A","nest","of","policy","states","to","be","fed","into","the","next","call","to","action",".","`","info","`",":","Optional","side","information","such","as","action","log","probabilities",".","Raises",":","NotImplementedError",":","if","`","seed","`","is","not","None","."]
code: def _action(
      self,
      time_step: ts.TimeStep,
      policy_state: types.NestedArray,
      seed: Optional[types.Seed] = None,
  ) -> ps.PolicyStep:
      """Forward a batch of time_step and policy_states to the wrapped policies.
  
      Args:
        time_step: A `TimeStep` tuple corresponding to `time_step_spec()`.
        policy_state: An Array, or a nested dict, list or tuple of Arrays
          representing the previous policy_state.
        seed: Seed value used to initialize a pseudorandom number generator.
  
      Returns:
        A batch of `PolicyStep` named tuples, each one containing:
          `action`: A nest of action Arrays matching the `action_spec()`.
          `state`: A nest of policy states to be fed into the next call to action.
          `info`: Optional side information such as action log probabilities.
  
      Raises:
        NotImplementedError: if `seed` is not None.
      """
      if seed is not None:
          raise NotImplementedError(
              "seed is not supported; but saw seed: {}".format(seed)
          )
      if (
          self._num_policies == 1
      ):  # pytype: disable=attribute-error  # trace-all-classes
          time_step = nest_utils.unbatch_nested_array(time_step)
          policy_state = nest_utils.unbatch_nested_array(policy_state)
          policy_steps = self._policies[0].action(
              time_step, policy_state
          )  # pytype: disable=attribute-error  # trace-all-classes
          return nest_utils.batch_nested_array(policy_steps)
      else:
          unstacked_time_steps = nest_utils.unstack_nested_arrays(
              time_step
          )
          if len(unstacked_time_steps) != len(
              self._policies
          ):  # pytype: disable=attribute-error  # trace-all-classes
              raise ValueError(
                  "Primary dimension of time_step items does not match "
                  "batch size: %d vs. %d"
                  % (
                      len(unstacked_time_steps),
                      len(self._policies),
                  )  # pytype: disable=attribute-error  # trace-all-classes
              )
          unstacked_policy_states = [()] * len(unstacked_time_steps)
          if policy_state:
              unstacked_policy_states = (
                  nest_utils.unstack_nested_arrays(policy_state)
              )
              if len(unstacked_policy_states) != len(
                  self._policies
              ):  # pytype: disable=attribute-error  # trace-all-classes
                  raise ValueError(
                      "Primary dimension of policy_state items does not match "
                      "batch size: %d vs. %d"
                      % (
                          len(unstacked_policy_states),
                          len(self._policies),
                      )  # pytype: disable=attribute-error  # trace-all-classes
                  )
          policy_steps = self._execute(
              _execute_policy,
              zip(
                  self._policies,  # pytype: disable=attribute-error  # trace-all-classes
                  unstacked_time_steps,
                  unstacked_policy_states,
              ),
          )
          return nest_utils.stack_nested_arrays(policy_steps)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from multiprocessing import dummy
  from typing import Sequence, Optional
  import gin
  from tf_agents.policies import py_policy
  from tf_agents.trajectories import policy_step
  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 6 for calling the BatchedPyPolicy obj's underlying member method code with example usage: obj._action(time_step, policy_state, seed) and returns: nest_utils, nest_utils