code: def check_unused_parameters(parameters, model, config):
      optimizer_param_set = {
          p for group in parameters for p in group["params"]
      }
      unused_param_names = []
      for n, p in model.named_parameters():
          if p.requires_grad and p not in optimizer_param_set:
              unused_param_names.append(n)
      if len(unused_param_names) > 0:
          logger.info(
              "Model parameters not used by optimizer: {}".format(
                  " ".join(unused_param_names)
              )
          )
          if not config.optimizer.allow_unused_parameters:
              raise Exception(
                  "Found model parameters not used by optimizer. Please check the "
                  "model's get_optimizer_parameters and add all parameters. If this "
                  "is intended, set optimizer.allow_unused_parameters to True to "
                  "ignore it."
              )
  
imports: import collections
  import gc
  import logging
  import math
  import os
  import sys
  import time
  import warnings
  from bisect import bisect
  from typing import Any, Callable, Dict
  import torch
  from mmf.utils.distributed import get_rank, get_world_size, is_xla
  from mmf.utils.file_io import PathManager
  from packaging import version
  from torch import nn, Tensor
label_desc: Use image node_id 8 for calling a global function with example usage: check_unused_parameters(parameters, model, config) without return types