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)
| 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 |