code: def _get_masked_scores(logu, mask):
      """Helper function to mask out selected elements from a logit tensor.
  
      All the elements corresponding to `False` in the `mask` will
      be set to `-inf`, so that they are excluded from logsumexp calculations.
  
      Args:
        logu: `float`-like `Tensor` representing scores to be masked.
        mask: `bool`-like `Tensor` of the same shape of `logu` representing
          a mask for selected samples.
  
      Returns:
        masked_scores: `float`-like `Tensor` contains the masked values.
      """
      with tf.name_scope("get_masked_scores"):
          logu = tf.convert_to_tensor(
              logu, dtype_hint=tf.float32, name="logu"
          )
          mask = tf.convert_to_tensor(mask, dtype=tf.bool, name="mask")
          return tf.where(
              mask, logu, tf.constant(-np.inf, dtype=logu.dtype)
          )
  
file_path: probability/tensorflow_probability/python/vi/mutual_information.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 3 for calling a global function with example usage: _get_masked_scores(logu, mask) and returns: tf