class_docstr: A logical view of a physical cluster. For example, we could view a physical cluster
  with 16 devices as a device mesh with shape (2, 2, 4) or (4, 4).
  
  Arguments:
      physical_mesh_id (torch.Tensor): physical view of the devices in global rank.
      logical_mesh_id (torch.Tensor): logical view of the devices in global rank.
      mesh_shape (torch.Size, optional): shape of logical view.
      mesh_alpha (List[float], optional): coefficients used for computing
          communication cost (default: None)
      mesh_beta (List[float], optional): coefficients used for computing
          communication cost (default: None)
      init_process_group (bool, optional): initialize logical process group
          during initializing the DeviceMesh instance if the init_process_group set to True.
          Otherwise, users need to call create_process_groups_for_logical_mesh manually to init logical process group.
          (default: False)
      device (str): the device for the process groups used by the DeviceMesh instance. (default: 'cuda')
docstr: Return the ranks in the process group on the specified axis.
  
  Args:
      axis (int): the axis of the process group.
      global_rank (int, optional): the global rank of the process
docstr_tok: ["Return","the","ranks","in","the","process","group","on","the","specified","axis",".","Args",":","axis","(","int",")",":","the","axis","of","the","process","group",".","global_rank","(","int",",","optional",")",":","the","global","rank","of","the","process"]
code: def get_ranks_in_process_group(
      self, axis: int, global_rank: int = None
  ) -> List[int]:
      """
      Return the ranks in the process group on the specified axis.
  
      Args:
          axis (int): the axis of the process group.
          global_rank (int, optional): the global rank of the process
      """
      if global_rank is None:
          global_rank = self._global_rank_of_current_process
      elif self._is_init_from_process_group:
          raise RuntimeError(
              "The logical device mesh is create with DeviceMesh.from_process_group, this method is not supported for this creation method as no global rank information is known."
          )
      return self._ranks_in_the_process_group[global_rank][axis]
  
imports: import operator
  from dataclasses import dataclass
  from functools import reduce
  from typing import Dict, List, Union
  import torch
  import torch.distributed
  from torch.distributed import ProcessGroup
label_desc: Use image node_id 9 for calling the DeviceMesh obj's underlying member method code with example usage: obj.get_ranks_in_process_group(axis, global_rank) and returns: self