def _randomly_negate_tensor(tensor):
    'With 50% prob turn the tensor negative.'
    should_flip = tf.cast(tf.floor((tf.random_uniform([]) + 0.5)), tf.bool)
    final_tensor = tf.cond(should_flip, (lambda : tensor), (lambda : (- tensor)))
    return final_tensor
With 50% prob turn the tensor negative.
def _randomly_negate_tensor(tensor):
    
    should_flip = tf.cast(tf.floor((tf.random_uniform([]) + 0.5)), tf.bool)
    final_tensor = tf.cond(should_flip, (lambda : tensor), (lambda : (- tensor)))
    return final_tensor