code: def _manual_seed(
      self,
      device_mesh: DeviceMesh,
      base_seed: int = 1234,
      tp_dim: int = 0,
  ):
      coordinate = device_mesh.get_coordinate()
      assert coordinate is not None
      tensor_parallel_rank = coordinate[tp_dim]
      # this magic number 2718 comes from Megatron's code
      # (https://github.com/NVIDIA/Megatron-LM/blob/060415572f4365a2e895f8036c4e37dad0efbdf5/megatron/core/tensor_parallel/random.py#L162-L163)
      MegatronMagicNum = 2718
      tensor_parallel_seed = (
          base_seed + MegatronMagicNum + tensor_parallel_rank
      )
      self.set_seed("tensor-parallel-rng", tensor_parallel_seed)
  
imports: import contextlib
  import warnings
  from typing import Dict, List, Optional
  import torch
  import torch.distributed
  from torch import Tensor
  from torch.distributed._tensor.placement_types import DTensorSpec, Shard
  from torch.distributed.device_mesh import _get_device_handle, DeviceMesh
label_desc: Use image node_id 2 for calling the TensorParallelRNGTracker obj's underlying member method code with example usage: obj._manual_seed(device_mesh, base_seed, tp_dim) without return types