tf.keras.tree.is_nested

Checks if a given structure is nested.

Examples:

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

structure A structure to check.

True if a given structure is nested, i.e. is a sequence, a mapping, or a namedtuple, and False otherwise.