# tf.contrib.framework.smart_case

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/framework/smart_cond.py#L93-L119) |

Like tf.case, except attempts to statically evaluate predicates.

    tf.contrib.framework.smart_case(
        pred_fn_pairs, default=None, exclusive=False, name='smart_case'
    )

If any predicate in `pred_fn_pairs` is a bool or has a constant value, the
associated callable will be called or omitted depending on its value.
Otherwise this functions like tf.case.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `pred_fn_pairs` | Dict or list of pairs of a boolean scalar tensor and a callable which returns a list of tensors. |
| `default` | Optional callable that returns a list of tensors. |
| `exclusive` | True iff at most one predicate is allowed to evaluate to `True`. |
| `name` | A name for this operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The tensors returned by the first pair whose predicate evaluated to True, or those returned by `default` if none does. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If `pred_fn_pairs` is not a list/dictionary. |
| `TypeError` | If `pred_fn_pairs` is a list but does not contain 2-tuples. |
| `TypeError` | If `fns[i]` is not callable for any i, or `default` is not callable. |

<br />