code: def retain_grad(x: Any) -> None:
      """Call retain_grad() on a tensor.
  
      Args:
          x (Any): Object to be called.
      """
      if isinstance(x, torch.Tensor) and x.requires_grad:
          x.retain_grad()
  
file_path: colossalai/colossalai/pipeline/schedule/_utils.py
imports: from collections import OrderedDict
  from typing import Any, List, Optional, Tuple
  import torch
  import torch.cuda
  from torch.nn import Module
  from torch.utils._pytree import SUPPORTED_NODES, TreeSpec, _register_pytree_node, tree_flatten, tree_map, tree_unflatten
label_desc: Use image node_id 9 for calling a global function with example usage: retain_grad(x) without return types