code: def get_only_requires_grad(parameters, requires_grad=True):
      if isinstance(parameters, list):
          if not parameters:
              return []
          elif isinstance(parameters[0], tuple):
              return [
                  (n, p)
                  for n, p in parameters
                  if p.requires_grad == requires_grad
              ]
          else:
              return [
                  p
                  for p in parameters
                  if p.requires_grad == requires_grad
              ]
      elif isinstance(parameters, dict):
          return {
              n: p
              for n, p in parameters
              if p.requires_grad == requires_grad
          }
      else:
          # TODO: Support generators  (issue #1178)
          raise RuntimeError("generators not yet supported")
  
imports: import copy
  import math
  import os
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils.data import Dataset, DataLoader
label_desc: Use image node_id 10 for calling a global function with example usage: get_only_requires_grad(parameters, requires_grad) and returns: list, unknown, unknown, unknown