# tf.contrib.framework.nest.yield_flat_paths

<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/util/nest.py#L1240-L1277) |

Yields paths for some nested structure.

    tf.contrib.framework.nest.yield_flat_paths(
        nest, expand_composites=False
    )

Paths are lists of objects which can be str-converted, which may include
integers or other types which are used as indices in a dict.

The flat list will be in the corresponding order as if you called
`snt.nest.flatten` on the structure. This is handy for naming Tensors such
the TF scope structure matches the tuple structure.

E.g. if we have a tuple `value = Foo(a=3, b=Bar(c=23, d=42))`

    >>> nest.flatten(value)
    [3, 23, 42]
    >>> list(nest.yield_flat_paths(value))
    [('a',), ('b', 'c'), ('b', 'd')]

    >>> list(nest.yield_flat_paths({'a': [3]}))
    [('a', 0)]
    >>> list(nest.yield_flat_paths({'a': 3}))
    [('a',)]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `nest` | the value to produce a flattened paths list for. |
| `expand_composites` | If true, then composite tensors such as tf.SparseTensor and tf.RaggedTensor are expanded into their component tensors. |

<br />

#### Yields:

Tuples containing index or key values which form the path to a specific
leaf value in the nested structure.