<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/checkpoint/trackable_view.py#L25-L117) |

Gathers and serializes a trackable view.

    tf.train.TrackableView(
        root
    )

#### Example usage:

    class SimpleModule(tf.Module):
      def __init__(self, name=None):
        super().__init__(name=name)
        self.a_var = tf.Variable(5.0)
        self.b_var = tf.Variable(4.0)
        self.vars = [tf.Variable(1.0), tf.Variable(2.0)]

    root = SimpleModule(name="root")
    root.leaf = SimpleModule(name="leaf")
    trackable_view = tf.train.TrackableView(root)

Pass root to tf.train.TrackableView.children() to get the dictionary of all
children directly linked to root by name.

    >>> trackable_view_children = trackable_view.children(root)
    >>> for item in trackable_view_children.items():
    ...   print(item)
    ('a_var', <tf.Variable 'Variable:0' shape=() dtype=float32, numpy=5.0>)
    ('b_var', <tf.Variable 'Variable:0' shape=() dtype=float32, numpy=4.0>)
    ('vars', ListWrapper([<tf.Variable 'Variable:0' shape=() dtype=float32,
    numpy=1.0>, <tf.Variable 'Variable:0' shape=() dtype=float32, numpy=2.0>]))
    ('leaf', ...)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `root` | A `Trackable` object whose variables (including the variables of dependencies, recursively) should be saved. May be a weak reference. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `root` | <br /> <br /> |

<br />

## Methods

### `children`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/checkpoint/trackable_view.py#L69-L87)

    @classmethod
    children(
        obj, save_type=base.SaveType.CHECKPOINT, **kwargs
    )

Returns all child trackables attached to obj.

<br />

<br />

<br />

| Args ||
|---|---|
| `obj` | A `Trackable` object. |
| `save_type` | A string, can be 'savedmodel' or 'checkpoint'. |
| `**kwargs` | kwargs to use when retrieving the object's children. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| Dictionary of all children attached to the object with name to trackable. ||

<br />

### `descendants`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/checkpoint/trackable_view.py#L98-L100)

    descendants()

Returns a list of all nodes from self.root using a breadth first traversal.