class_docstr: Random-state context manager class. Reference: https://github.com/luyug/GradCache.
  
  This class will back up the pytorch's random state during initialization. Then when the context is activated,
  the class will set up the random state with the backed-up one.
code: def __init__(self, *tensors):
      self.fwd_cpu_state = torch.get_rng_state()
      self.fwd_gpu_devices, self.fwd_gpu_states = get_device_states(
          *tensors
      )
  
imports: from __future__ import annotations
  from contextlib import nullcontext
  from functools import partial
  import torch
  from torch import nn, Tensor
  from torch.utils.checkpoint import get_device_states, set_device_states
  from typing import Iterable, Dict, Iterator, List, Optional, Tuple
  from sentence_transformers import SentenceTransformer
  from sentence_transformers import util
  import tqdm
label_desc: Use image node_id 1 to create a new RandContext object  with example: obj = RandContext()