class_docstr: Abstract base class for TF Policies.
  
  The Policy represents a mapping from `time_steps` recieved from the
  environment to `actions` that can be applied to the environment.
  
  Agents expose two policies. A `policy` meant for deployment and evaluation,
  and a `collect_policy` for collecting data from the environment. The
  `collect_policy` is usually stochastic for exploring the environment better
  and may log auxilliary information such as log probabilities required for
  training as well. `Policy` objects can also be created directly by the users
  without using an `Agent`.
  
  The main methods of TFPolicy are:
  
  * `action`: Maps a `time_step` from the environment to an action.
  * `distribution`: Maps a `time_step` to a distribution over actions.
  * `get_initial_state`: Generates the initial state for stateful policies, e.g.
      RNN/LSTM policies.
  
  Example usage:
  
  ```
  env = SomeTFEnvironment()
  policy = TFRandomPolicy(env.time_step_spec(), env.action_spec())
  # Or policy = agent.policy or agent.collect_policy
  
  policy_state = policy.get_initial_state(env.batch_size)
  time_step = env.reset()
  
  while not time_step.is_last():
    policy_step = policy.action(time_step, policy_state)
    time_step = env.step(policy_step.action)
  
    policy_state = policy_step.state
    # policy_step.info may contain side info for logging, such as action log
    # probabilities.
  ```
  
  Policies can be saved to disk as SavedModels (see policy_saver.py and
  policy_loader.py) or as TF Checkpoints.
  
  A `PyTFEagerPolicy` can be used to wrap a `TFPolicy` so that it works with
  `PyEnvironment`s.
  
  
  **NOTE**: For API consistency, subclasses are not allowed to override public
  methods of `TFPolicy` class. Instead, they may implement the protected methods
  including `_get_initial_state`, `_action`, and `_distribution`. This
  public-calls-private convention allowed this base class to do things like
  properly add `spec` and shape checks, which provide users an easier experience
  when debugging their environments and networks.
  
  For researchers, and those developing new Policies, the `TFPolicy` base class
  constructor also accept a `validate_args` parameter.  If `False`, this
  disables all spec structure, dtype, and shape checks in the public methods of
  these classes.  It allows algorithm developers to iterate and try different
  input and output structures without worrying about overly restrictive
  requirements, or input and output states being in a certain format.  However,
  *disabling argument validation* can make it very hard to identify structural
  input or algorithmic errors; and should not be done for final, or
  production-ready, Policies.  In addition to having implementations that may
  disagree with specs, this mean that the resulting Policy may no longer
  interact well with other parts of TF-Agents.  Examples include impedance
  mismatches with Actor/Learner APIs, replay buffers, and the model export
  functionality in `PolicySaver.
docstr: Describes the `TimeStep` tensors returned by `step()`.
  
  Returns:
    A `TimeStep` namedtuple with `TensorSpec` objects instead of Tensors,
    which describe the shape, dtype and name of each tensor returned by
    `step()`.
code: def time_step_spec(self) -> ts.TimeStep:
      """Describes the `TimeStep` tensors returned by `step()`.
  
      Returns:
        A `TimeStep` namedtuple with `TensorSpec` objects instead of Tensors,
        which describe the shape, dtype and name of each tensor returned by
        `step()`.
      """
      return self._time_step_spec
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  from typing import Optional, Sequence, Text
  import six
  import tensorflow
  import tensorflow_probability
  from tf_agents.distributions import reparameterized_sampling
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  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 12 for calling the TFPolicy obj's underlying member method code with example usage: obj.time_step_spec() and returns: self