class_docstr: Policy that samples actions based on the FALCON algorithm.
class_docstr_tok: ["Policy","that","samples","actions","based","on","the","FALCON","algorithm","."]
docstr: Gets the number of allowed actions.
  
  Args:
    mask: An optional mask represented by a tensor shaped as [batch_size,
      num_actions].
  
  Returns:
    The number of allowed actions. It can be either a scalar (when `mask` is
    None), or a tensor shaped as [batch_size].
docstr_tok: ["Gets","the","number","of","allowed","actions",".","Args",":","mask",":","An","optional","mask","represented","by","a","tensor","shaped","as","[","batch_size",",","num_actions","]",".","Returns",":","The","number","of","allowed","actions",".","It","can","be","either","a","scalar","(","when","`","mask","`","is","None",")",",","or","a","tensor","shaped","as","[","batch_size","]","."]
code: def _get_number_of_allowed_actions(
      self, mask: Optional[types.Tensor]
  ) -> types.Float:
      """Gets the number of allowed actions.
  
      Args:
        mask: An optional mask represented by a tensor shaped as [batch_size,
          num_actions].
  
      Returns:
        The number of allowed actions. It can be either a scalar (when `mask` is
        None), or a tensor shaped as [batch_size].
      """
      return (
          tf.cast(self._expected_num_actions, dtype=tf.float32)
          if mask is None
          else tf.reduce_sum(
              tf.cast(tf.cast(mask, tf.bool), tf.float32), axis=1
          )
      )
  
file_path: agents/tf_agents/bandits/policies/falcon_reward_prediction_policy.py
imports: from typing import Iterable, Optional, Sequence, Text, Tuple
  import tensorflow
  import tensorflow_probability
  from tf_agents.bandits.policies import constraints
  from tf_agents.bandits.policies import reward_prediction_base_policy
  from tf_agents.distributions import shifted_categorical
  from tf_agents.policies import utils
  from tf_agents.typing import types
label_desc: Use image node_id 5 for calling the FalconRewardPredictionPolicy obj's underlying member method code with example usage: obj._get_number_of_allowed_actions(mask) and returns: unknown