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

Method buffers

imperative/python/megengine/module/module.py:264–275  ·  view source on GitHub ↗

r"""Returns an iterable for the buffers of the module. Buffer is defined to be :class:`~.Tensor` excluding :class:`~.Parameter`. Args: recursive: if ``True``, returns all buffers within this module, else only returns buffers that are direct attributes

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

Source from the content-addressed store, hash-verified

262 )
263
264 def buffers(self, recursive: bool = True, **kwargs) -> Iterable[Tensor]:
265 r"""Returns an iterable for the buffers of the module.
266
267 Buffer is defined to be :class:`~.Tensor` excluding :class:`~.Parameter`.
268
269 Args:
270 recursive: if ``True``, returns all buffers within this
271 module, else only returns buffers that are direct attributes
272 """
273 yield from self._flatten(
274 with_key=False, predicate=_is_buffer, recursive=recursive, **kwargs
275 )
276
277 def named_buffers(
278 self, prefix: Optional[str] = None, recursive: bool = True, **kwargs

Callers 2

flatten_inputsMethod · 0.80
test_module_apiFunction · 0.80

Calls 1

_flattenMethod · 0.95

Tested by 1

test_module_apiFunction · 0.64