class_docstr: Epsilon greedy sampling with action masking on network outputs.
docstr: Initialize the network and epsilon.
  
  Usage:
    Wrap an observation in a dictionary in your environment as follows:
  
      observation <-- {"your_key_for_observation": observation,
                       "legal_actions_mask": your_action_mask_tensor}
  
  and update your network to use 'observation["your_key_for_observation"]'
  rather than 'observation'.
  
  Args:
    network: the online Q network (the one being optimized)
    epsilon: probability of taking a random action.
docstr_tok: ["Initialize","the","network","and","epsilon",".","Usage",":","Wrap","an","observation","in","a","dictionary","in","your","environment","as","follows",":","observation","<","--","{","``","your_key_for_observation","''",":","observation",",","``","legal_actions_mask","''",":","your_action_mask_tensor","}","and","update","your","network","to","use","'observation","[","``","your_key_for_observation","''","]","'","rather","than","'observation","'",".","Args",":","network",":","the","online","Q","network","(","the","one","being","optimized",")","epsilon",":","probability","of","taking","a","random","action","."]
code: def __init__(
      self, network: snt.Module, epsilon: Optional[tf.Tensor] = None
  ):
      """Initialize the network and epsilon.
  
      Usage:
        Wrap an observation in a dictionary in your environment as follows:
  
          observation <-- {"your_key_for_observation": observation,
                           "legal_actions_mask": your_action_mask_tensor}
  
      and update your network to use 'observation["your_key_for_observation"]'
      rather than 'observation'.
  
      Args:
        network: the online Q network (the one being optimized)
        epsilon: probability of taking a random action.
      """
      super().__init__()
      self._network = network
      self._epsilon = epsilon
  
file_path: acme/acme/tf/networks/masked_epsilon_greedy.py
imports: from typing import Optional, Mapping, Union
  import sonnet
  import tensorflow
  import trfl
label_desc: Use image node_id 1 to create a new NetworkWithMaskedEpsilonGreedy object from inherited base classes: snt with example: obj = NetworkWithMaskedEpsilonGreedy(network, epsilon)