def _apply_negative_infinity_mask(tensor, mask):
  """Where mask is true, add a large negative value."""
  tensor += tf.to_float(mask) * -INF
  tensor = tf.maximum(tensor, -INF)
  return tensor
Where mask is true, add a large negative value.
language/xsp/model/beam_search.py