parameters: (y_p, sw, mask)
return_statement: return sw
docstring: Applies any mask on predictions to sample weights.
docstring_summary: Applies any mask on predictions to sample weights.
docstring_tokens: Applies any mask on predictions to sample weights .
function: def apply_mask(y_p, sw, mask):
    """Applies any mask on predictions to sample weights."""
    if mask is not None:
      mask = math_ops.cast(mask, y_p.dtype)
      if sw is not None:
        mask, _, sw = (
            losses_utils.squeeze_or_expand_dimensions(mask, sample_weight=sw))
        sw *= mask
      else:
        sw = mask
    return sw
function_tokens: def apply_mask ( y_p , sw , mask ) : if mask is not None : mask = math_ops . cast ( mask , y_p . dtype ) if sw is not None : mask , _ , sw = ( losses_utils . squeeze_or_expand_dimensions ( mask , sample_weight = sw ) ) sw *= mask else : sw = mask return sw