code: def filter_requires_grad(pgroups):
      
      warnings.warn(
          "For filtering gradients, please use skorch.callbacks.Freezer.",
          DeprecationWarning)
  
      for pgroup in pgroups:
          output = {k: v for k, v in pgroup.items() if k != 'params'}
          output['params'] = (p for p in pgroup['params'] if p.requires_grad)
          yield output
docs: Returns parameter groups where parameters
      that don't require a gradient are filtered out.
  
      Parameters
      ----------
      pgroups : dict
        Parameter groups to be filtered