<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/tree/tree_api.py#L34-L52) |

Checks if a given structure is nested.

    tf.keras.tree.is_nested(
        structure
    )

#### Examples:

    keras.tree.is_nested(42)
    False
    keras.tree.is_nested({"foo": 42})
    True

<br />

<br />

<br />

| ## Args ||
|---|---|
| `structure` | A structure to check. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `True` if a given structure is nested, i.e. is a sequence, a mapping, or a namedtuple, and `False` otherwise. ||

<br />