MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / tensors

Method tensors

imperative/python/megengine/module/module.py:300–310  ·  view source on GitHub ↗

r""" Returns an iterable for the :class:`~.Tensor` of the module. :param recursive: If ``True``, returns all :class:`~.Tensor` within this module, else only returns :class:`~.Tensor` that are direct attributes of this module.

(self, recursive: bool = True, **kwargs)

Source from the content-addressed store, hash-verified

298 )
299
300 def tensors(self, recursive: bool = True, **kwargs) -> Iterable[Parameter]:
301 r"""
302 Returns an iterable for the :class:`~.Tensor` of the module.
303
304 :param recursive: If ``True``, returns all :class:`~.Tensor` within this
305 module, else only returns :class:`~.Tensor` that are direct attributes
306 of this module.
307 """
308 yield from self._flatten(
309 with_key=False, predicate=_is_tensor, recursive=recursive, **kwargs
310 )
311
312 def named_tensors(
313 self, prefix: Optional[str] = None, recursive: bool = True, **kwargs

Callers 11

trace_moduleFunction · 0.80
runnerFunction · 0.80
test_module_apiFunction · 0.80
load_tensor_formatMethod · 0.80
load_tensorMethod · 0.80
load_tensor_sharedMethod · 0.80
load_tensorMethod · 0.80
load_tensor_sharedMethod · 0.80
loadMethod · 0.80
loadMethod · 0.80
loadMethod · 0.80

Calls 1

_flattenMethod · 0.95

Tested by 2

runnerFunction · 0.64
test_module_apiFunction · 0.64