r"""Returns an iterable for key buffer pairs of the module, where ``key`` is the dotted path from this module to the buffer. Buffer is defined to be :class:`~.Tensor` excluding :class:`~.Parameter`. Args: prefix: prefix prepended to the keys. recursi
(
self, prefix: Optional[str] = None, recursive: bool = True, **kwargs
)
| 275 | ) |
| 276 | |
| 277 | def named_buffers( |
| 278 | self, prefix: Optional[str] = None, recursive: bool = True, **kwargs |
| 279 | ) -> Iterable[Tuple[str, Tensor]]: |
| 280 | r"""Returns an iterable for key buffer pairs of the module, where |
| 281 | ``key`` is the dotted path from this module to the buffer. |
| 282 | |
| 283 | Buffer is defined to be :class:`~.Tensor` excluding :class:`~.Parameter`. |
| 284 | |
| 285 | Args: |
| 286 | prefix: prefix prepended to the keys. |
| 287 | recursive: if ``True``, returns all buffers within this |
| 288 | module, else only returns buffers that are direct attributes |
| 289 | of this module. |
| 290 | prefix: Optional[str]: |
| 291 | """ |
| 292 | yield from self._flatten( |
| 293 | with_key=True, |
| 294 | prefix=prefix, |
| 295 | predicate=_is_buffer, |
| 296 | recursive=recursive, |
| 297 | **kwargs, |
| 298 | ) |
| 299 | |
| 300 | def tensors(self, recursive: bool = True, **kwargs) -> Iterable[Parameter]: |
| 301 | r""" |