def _pick_scalar_condition(pred, cond_true, cond_false):
<EOL>pred_ = tf.get_static_value(tf.convert_to_tensor(value=pred))<EOL>if pred_ is None:<EOL><INDENT>return tf.where(pred, cond_true, cond_false)<EOL><DEDENT>return cond_true if pred_ else cond_false<EOL>
Convenience function which chooses the condition based on the predicate.