code: def get_parameters(model, keys=None, mode="include"):
      if keys is None:
          for name, param in model.named_parameters():
              yield param
      elif mode == "include":
          for name, param in model.named_parameters():
              flag = False
              for key in keys:
                  if key in name:
                      flag = True
                      break
              if flag:
                  yield param
      elif mode == "exclude":
          for name, param in model.named_parameters():
              flag = True
              for key in keys:
                  if key in name:
                      flag = False
                      break
              if flag:
                  yield param
      else:
          raise ValueError("do not support: %s" % mode)
  
file_path: nni/examples/nas/legacy/oneshot/proxylessnas/putils.py
imports: import torch
  import nni.retiarii.nn.pytorch
label_desc: Use image node_id 1 for calling a global function with example usage: get_parameters(model, keys, mode) without return types