<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#L308-L334) |

Asserts that two structures have identical paths in their tree structure.

    tf.keras.tree.assert_same_paths(
        a, b
    )

This function verifies that two nested structures have the same paths.
Unlike `assert_same_structure`, this function only checks the paths
and ignores the collection types.
For Sequences, to path is the index: 0, 1, 2, etc. For Mappings, the path is
the key, for instance "a", "b", "c". Note that namedtuples also use indices
and not field names for the path.

#### Examples:

    keras.tree.assert_same_paths([0, 1], (2, 3))
    Point1 = collections.namedtuple('Point1', ['x', 'y'])
    Point2 = collections.namedtuple('Point2', ['x', 'y'])
    keras.tree.assert_same_paths(Point1(0, 1), Point2(2, 3))

<br />

<br />

<br />

| ## Args ||
|---|---|
| `a` | an arbitrarily nested structure. |
| `b` | an arbitrarily nested structure. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If the paths in structure `a` don't match the paths in structure `b`. The error message will include the specific paths that differ. |

<br />