class_docstr: Common functionality between `Optimizer` and `OptimWrapper`
class_docstr_tok: ["Common","functionality","between","`","Optimizer","`","and","`","OptimWrapper","`"]
code: def all_params(
      self,
      n: slice
      | int = slice(
          None
      ),  # Extended slicing over the optimizer `param_lists`
      with_grad: bool = False,  # Get all param tuples. If `True` select only those with a gradient
  ):
      res = L(
          (p, pg, self.state[p], hyper)
          for pg, hyper in zip(self.param_lists[n], self.hypers[n])
          for p in pg
      )
      return (
          L(
              o
              for o in res
              if hasattr(o[0], "grad") and o[0].grad is not None
          )
          if with_grad
          else res
      )
  
imports: from __future__ import annotations
  from .torch_basics import *
label_desc: Use image node_id 1 for calling the _BaseOptimizer obj's underlying member method code with example usage: obj.all_params(n, with_grad) and returns: unknown