MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / submodules

Method submodules

tensorflow/python/module/module.py:173–193  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 2

_flattenMethod · 0.95
tupleFunction · 0.85

Tested by

no test coverage detected