code: def _find_optimizers_for_module(
      module: torch.nn.Module,
      optimizers: Dict[str, torch.optim.Optimizer],
  ) -> List[Tuple[str, torch.optim.Optimizer]]:
      """
      Given a module, returns a list of optimizers that are associated with it.
      """
      optimizer_list = []
      module_params = [
          param.data_ptr() for param in module.parameters()
      ]
      for optim_name, optimizer in optimizers.items():
          optimizer_params = [
              param.data_ptr()
              for param in optimizer.param_groups[0]["params"]
          ]
          if all(
              module_param in optimizer_params
              for module_param in module_params
          ):
              optimizer_list.append((optim_name, optimizer))
      return optimizer_list
  
file_path: tnt/torchtnt/framework/_unit_utils.py
imports: import collections
  import inspect
  import logging
  from typing import Callable, Dict, List, Tuple, TypeVar
  import torch
  import typing_extensions
  from torchtnt.framework.state import State
label_desc: Use image node_id 2 for calling a global function with example usage: _find_optimizers_for_module(module, optimizers) and returns: optimizer_list