code: def requires_grad(m:nn.Module, b:Optional[bool]=None)->Optional[bool]:
      "If `b` is not set return `requires_grad` of first param, else set `requires_grad` on all params as `b`"
      ps = list(m.parameters())
      if not ps: return None
      if b is None: return ps[0].requires_grad
      for p in ps: p.requires_grad=f requires_grad(m:nn.Module, b:Optional[bool]=None)->Optional[bool]:
      "If `b` is not set return `requires_grad` of first param, else set `requires_grad` on all params as `b`"
      ps = list(m.parameters())
      if not ps: return None
      if b is None: return ps[0].requires_grad
      for p in ps: p.requires_grad=b
docs: If `b` is not set return `requires_grad` of first param, else set `requires_grad` on all params as `b`