tf.keras.tree.is_nested
Stay organized with collections
Save and categorize content based on your preferences.
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
Args |
structure
|
A structure to check.
|
Returns |
True if a given structure is nested, i.e. is a sequence, a mapping,
or a namedtuple, and False otherwise.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[null,null,["Last updated 2024-06-07 UTC."],[],[],null,["# tf.keras.tree.is_nested\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v3.3.3/keras/src/tree/tree_api.py#L20-L38) |\n\nChecks if a given structure is nested. \n\n tf.keras.tree.is_nested(\n structure\n )\n\n#### Examples:\n\n keras.tree.is_nested(42)\n False\n keras.tree.is_nested({\"foo\": 42})\n True\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|-----------------------|\n| `structure` | A structure to check. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| `True` if a given structure is nested, i.e. is a sequence, a mapping, or a namedtuple, and `False` otherwise. ||\n\n\u003cbr /\u003e"]]