parameters: (logits, regrets, threshold=2.0)
return_statement: return can_decrease * regrets_negative + can_increase * regrets_positive
docstring: Zeros out `regrets` where `logits` are too negative or too large.
docstring_summary: Zeros out `regrets` where `logits` are too negative or too large.
docstring_tokens: Zeros out regrets where logits are too negative or too large .
function: def thresholded(logits, regrets, threshold=2.0):
    """Zeros out `regrets` where `logits` are too negative or too large."""
    can_decrease = tf.cast(tf.greater(logits, -threshold), tf.float32)
    can_increase = tf.cast(tf.less(logits, threshold), tf.float32)
    regrets_negative = tf.minimum(regrets, 0.0)
    regrets_positive = tf.maximum(regrets, 0.0)
    return can_decrease * regrets_negative + can_increase * regrets_positive
function_tokens: def thresholded ( logits , regrets , threshold = 2.0 ) : can_decrease = tf . cast ( tf . greater ( logits , - threshold ) , tf . float32 ) can_increase = tf . cast ( tf . less ( logits , threshold ) , tf . float32 ) regrets_negative = tf . minimum ( regrets , 0.0 ) regrets_positive = tf . maximum ( regrets , 0.0 ) return can_decrease * regrets_negative + can_increase * regrets_positive