code: def _set_active_parameters(
      model: Module, layers: List[str]
  ) -> List[Module]:
      """
      sets relevant parameters, as indicated by `layers`, to have `requires_grad=True`,
      and returns relevant modules.
      """
      assert isinstance(layers, List), "`layers` should be a list!"
      assert len(layers) > 0, "`layers` cannot be empty!"
      assert isinstance(
          layers[0], str
      ), "`layers` should contain str layer names."
      layer_modules = [
          _get_module_from_name(model, layer) for layer in layers
      ]
      for layer, layer_module in zip(layers, layer_modules):
          for name, param in layer_module.named_parameters():
              if not param.requires_grad:
                  warnings.warn(
                      "Setting required grads for layer: {}, name: {}".format(
                          ".".join(layer), name
                      )
                  )
                  param.requires_grad = True
      return layer_modules
  
imports: import warnings
  from functools import reduce
  from typing import Any, Callable, Iterable, List, NamedTuple, Optional, Tuple, TYPE_CHECKING, Union
  import torch
  import torch.nn
  from captum._utils.common import _get_module_from_name, _parse_version
  from captum._utils.gradient import _compute_jacobian_wrt_params, _compute_jacobian_wrt_params_with_sample_wise_trick
  from captum._utils.progress import progress
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 9 for calling a global function with example usage: _set_active_parameters(model, layers) and returns: layer_modules