code: def _is_trainable(param: torch.Tensor) -> bool:
      r"""Return if a parameter is trainable, where trainability is equivalent to requiring a gradient."""
      return param.requires_grad
  
imports: import collections
  import copy
  import enum
  import inspect
  import io
  import logging
  from itertools import chain
  from typing import Any, Callable, Dict, List, Optional, Set, Type, Union
  import torch
  import torch.distributed
  from torch.distributed.algorithms.join import Join, Joinable, JoinHook
  from torch.distributed.optim.utils import functional_optim_map
  from torch.optim import Optimizer
label_desc: Use image node_id 2 for calling a global function with example usage: _is_trainable(param) and returns: param