class_docstr: A policy which always returns a fixed action.
class_docstr_tok: ["A","policy","which","always","returns","a","fixed","action","."]
docstr: A policy which always returns a fixed action.
  
  Args:
    actions: A Tensor, or a nested dict, list or tuple of Tensors
      corresponding to `action_spec()`.
    time_step_spec: A `TimeStep` spec of the expected time_steps.
    action_spec: A nest of BoundedTensorSpec representing the actions.
    emit_log_probability: Emit log-probabilities of actions, if supported. If
      True, policy_step.info will have CommonFields.LOG_PROBABILITY set.
      Please consult utility methods provided in policy_step for setting and
      retrieving these. When working with custom policies, either provide a
      dictionary info_spec or a namedtuple with the field 'log_probability'.
    policy_info: A policy info to be returned in PolicyStep.
    info_spec: A policy info spec.
    name: The name of this policy. All variables in this module will fall
      under that name. Defaults to the class name.
docstr_tok: ["A","policy","which","always","returns","a","fixed","action",".","Args",":","actions",":","A","Tensor",",","or","a","nested","dict",",","list","or","tuple","of","Tensors","corresponding","to","`","action_spec","(",")","`",".","time_step_spec",":","A","`","TimeStep","`","spec","of","the","expected","time_steps",".","action_spec",":","A","nest","of","BoundedTensorSpec","representing","the","actions",".","emit_log_probability",":","Emit","log-probabilities","of","actions",",","if","supported",".","If","True",",","policy_step.info","will","have","CommonFields.LOG_PROBABILITY","set",".","Please","consult","utility","methods","provided","in","policy_step","for","setting","and","retrieving","these",".","When","working","with","custom","policies",",","either","provide","a","dictionary","info_spec","or","a","namedtuple","with","the","field","'log_probability","'",".","policy_info",":","A","policy","info","to","be","returned","in","PolicyStep",".","info_spec",":","A","policy","info","spec",".","name",":","The","name","of","this","policy",".","All","variables","in","this","module","will","fall","under","that","name",".","Defaults","to","the","class","name","."]
code: def __init__(
      self,
      actions: types.NestedTensor,
      time_step_spec: ts.TimeStep,
      action_spec: types.NestedTensorSpec,
      emit_log_probability: bool = True,
      policy_info: types.NestedTensorSpec = (),
      info_spec: types.NestedTensorSpec = (),
      name: Optional[Text] = None,
  ):
      """A policy which always returns a fixed action.
  
      Args:
        actions: A Tensor, or a nested dict, list or tuple of Tensors
          corresponding to `action_spec()`.
        time_step_spec: A `TimeStep` spec of the expected time_steps.
        action_spec: A nest of BoundedTensorSpec representing the actions.
        emit_log_probability: Emit log-probabilities of actions, if supported. If
          True, policy_step.info will have CommonFields.LOG_PROBABILITY set.
          Please consult utility methods provided in policy_step for setting and
          retrieving these. When working with custom policies, either provide a
          dictionary info_spec or a namedtuple with the field 'log_probability'.
        policy_info: A policy info to be returned in PolicyStep.
        info_spec: A policy info spec.
        name: The name of this policy. All variables in this module will fall
          under that name. Defaults to the class name.
      """
      super(FixedPolicy, self).__init__(
          time_step_spec,
          action_spec,
          clip=False,
          info_spec=info_spec,
          name=name,
          emit_log_probability=emit_log_probability,
      )
      nest_utils.assert_same_structure(self._action_spec, actions)
  
      def convert(action, spec):
          return tf.convert_to_tensor(value=action, dtype=spec.dtype)
  
      self._action_value = tf.nest.map_structure(
          convert, actions, self._action_spec
      )
      if self._emit_log_probability:
          log_probability = tf.nest.map_structure(
              lambda t: tf.constant(0.0, tf.float32), self._action_spec
          )
          self._policy_info = policy_step.set_log_probability(
              policy_info, log_probability
          )  # pytype: disable=wrong-arg-types
      else:
          self._policy_info = policy_info
  
file_path: agents/tf_agents/policies/fixed_policy.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional, Text
  import tensorflow
  import tensorflow_probability
  from tf_agents.policies import tf_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 common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new FixedPolicy object from inherited base classes: tf_policy with example: obj = FixedPolicy(actions, time_step_spec, action_spec, emit_log_probability, policy_info, info_spec, name)