r"""Returns an iterable for the :class:`~.Parameter` of the module. Args: recursive: If ``True``, returns all :class:`~.Parameter` within this module, else only returns :class:`~.Parameter` that are direct attributes of this module.
(self, recursive: bool = True, **kwargs)
| 208 | ) |
| 209 | |
| 210 | def parameters(self, recursive: bool = True, **kwargs) -> Iterable[Parameter]: |
| 211 | r"""Returns an iterable for the :class:`~.Parameter` of the module. |
| 212 | |
| 213 | Args: |
| 214 | recursive: If ``True``, returns all :class:`~.Parameter` within this |
| 215 | module, else only returns :class:`~.Parameter` that are direct attributes |
| 216 | of this module. |
| 217 | """ |
| 218 | |
| 219 | if "requires_grad" in kwargs: |
| 220 | del kwargs["requires_grad"] |
| 221 | logger.warning( |
| 222 | "Tensor currently has no requires_grad attribute " |
| 223 | "so requires_grad argument is ignored here" |
| 224 | ) |
| 225 | |
| 226 | def predicate(obj) -> bool: |
| 227 | return _is_parameter(obj) |
| 228 | |
| 229 | yield from self._flatten( |
| 230 | with_key=False, predicate=predicate, recursive=recursive, **kwargs |
| 231 | ) |
| 232 | |
| 233 | def named_parameters( |
| 234 | self, prefix: Optional[str] = None, recursive: bool = True, **kwargs |