Sequence of all sub-modules. Submodules are modules which are properties of this module, or found as properties of modules which are properties of this module (and so on). ``` a = tf.Module() b = tf.Module() c = tf.Module() a.b = b b.c = c assert list(a.submodul
(self)
| 171 | |
| 172 | @property |
| 173 | def submodules(self): |
| 174 | """Sequence of all sub-modules. |
| 175 | |
| 176 | Submodules are modules which are properties of this module, or found as |
| 177 | properties of modules which are properties of this module (and so on). |
| 178 | |
| 179 | ``` |
| 180 | a = tf.Module() |
| 181 | b = tf.Module() |
| 182 | c = tf.Module() |
| 183 | a.b = b |
| 184 | b.c = c |
| 185 | assert list(a.submodules) == [b, c] |
| 186 | assert list(b.submodules) == [c] |
| 187 | assert list(c.submodules) == [] |
| 188 | ``` |
| 189 | |
| 190 | Returns: |
| 191 | A sequence of all submodules. |
| 192 | """ |
| 193 | return tuple(self._flatten(predicate=_is_module)) |
| 194 | |
| 195 | def _flatten(self, |
| 196 | recursive=True, |