class_docstr: Returns epsilon-greedy samples of a given policy.
docstr: Builds an epsilon-greedy MixturePolicy wrapping the given policy.
  
  Args:
    policy: A policy implementing the tf_policy.TFPolicy interface.
    epsilon: The probability of taking the random action represented as a
      float scalar, a scalar Tensor of shape=(), or a callable that returns a
      float scalar or Tensor.
    exploration_mask: A `[0, 1]` vector describing which actions should be in
      the set of exploratory actions.
    info_fields_to_inherit_from_greedy: A list of policy info fields which
      should be copied over from the greedy action's info, even if the random
      action was taken.
    name: The name of this policy.
  
  Raises:
    ValueError: If epsilon is invalid.
docstr_tok: ["Builds","an","epsilon-greedy","MixturePolicy","wrapping","the","given","policy",".","Args",":","policy",":","A","policy","implementing","the","tf_policy.TFPolicy","interface",".","epsilon",":","The","probability","of","taking","the","random","action","represented","as","a","float","scalar",",","a","scalar","Tensor","of","shape=","(",")",",","or","a","callable","that","returns","a","float","scalar","or","Tensor",".","exploration_mask",":","A","`","[","0",",","1","]","`","vector","describing","which","actions","should","be","in","the","set","of","exploratory","actions",".","info_fields_to_inherit_from_greedy",":","A","list","of","policy","info","fields","which","should","be","copied","over","from","the","greedy","action","'s","info",",","even","if","the","random","action","was","taken",".","name",":","The","name","of","this","policy",".","Raises",":","ValueError",":","If","epsilon","is","invalid","."]
code: def __init__(
      self,
      policy: tf_policy.TFPolicy,
      epsilon: types.FloatOrReturningFloat,
      exploration_mask: Optional[Sequence[int]] = None,
      info_fields_to_inherit_from_greedy: Sequence[Text] = (),
      name: Optional[Text] = None,
  ):
      """Builds an epsilon-greedy MixturePolicy wrapping the given policy.
  
      Args:
        policy: A policy implementing the tf_policy.TFPolicy interface.
        epsilon: The probability of taking the random action represented as a
          float scalar, a scalar Tensor of shape=(), or a callable that returns a
          float scalar or Tensor.
        exploration_mask: A `[0, 1]` vector describing which actions should be in
          the set of exploratory actions.
        info_fields_to_inherit_from_greedy: A list of policy info fields which
          should be copied over from the greedy action's info, even if the random
          action was taken.
        name: The name of this policy.
  
      Raises:
        ValueError: If epsilon is invalid.
      """
      try:
          observation_and_action_constraint_splitter = (
              policy.observation_and_action_constraint_splitter
          )
      except AttributeError:
          observation_and_action_constraint_splitter = None
      try:
          accepts_per_arm_features = policy.accepts_per_arm_features
      except AttributeError:
          accepts_per_arm_features = False
      self._greedy_policy = greedy_policy.GreedyPolicy(policy)
      self._epsilon = epsilon
      self._exploration_mask = exploration_mask
      self.info_fields_to_inherit_from_greedy = (
          info_fields_to_inherit_from_greedy
      )
      self._random_policy = random_tf_policy.RandomTFPolicy(
          policy.time_step_spec,
          policy.action_spec,
          emit_log_probability=policy.emit_log_probability,
          observation_and_action_constraint_splitter=(
              observation_and_action_constraint_splitter
          ),
          accepts_per_arm_features=accepts_per_arm_features,
          stationary_mask=exploration_mask,
          info_spec=policy.info_spec,
      )
      super(EpsilonGreedyPolicy, self).__init__(
          policy.time_step_spec,
          policy.action_spec,
          policy.policy_state_spec,
          policy.info_spec,
          emit_log_probability=policy.emit_log_probability,
          observation_and_action_constraint_splitter=(
              observation_and_action_constraint_splitter
          ),
          name=name,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional, Sequence, Text
  import gin
  import tensorflow
  import tensorflow_probability
  from tf_agents.policies import greedy_policy
  from tf_agents.policies import random_tf_policy
  from tf_agents.policies import tf_policy
  from tf_agents.policies import utils
  from tf_agents.trajectories import policy_step
  from tf_agents.typing import types
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new EpsilonGreedyPolicy object from inherited base classes: tf_policy with example: obj = EpsilonGreedyPolicy(policy, epsilon, exploration_mask, info_fields_to_inherit_from_greedy, name)