class_docstr: PipelineStageManager is a helper class to manage pipeline stages.
  
  Args:
      pg_mesh (ProcessGroupMesh): Process group mesh.
      pipeline_axis (int): The axis along which the pipeline is constructed.
      is_virtual (bool): Whether to use circle p2p communication, it will make the first and last stage communicate with each other.
  
  Attributes:
      num_stages (int): Number of stages in the pipeline.
      stage (int): The current stage.
class_docstr_tok: ["PipelineStageManager","is","a","helper","class","to","manage","pipeline","stages",".","Args",":","pg_mesh","(","ProcessGroupMesh",")",":","Process","group","mesh",".","pipeline_axis","(","int",")",":","The","axis","along","which","the","pipeline","is","constructed",".","is_virtual","(","bool",")",":","Whether","to","use","circle","p2p","communication",",","it","will","make","the","first","and","last","stage","communicate","with","each","other",".","Attributes",":","num_stages","(","int",")",":","Number","of","stages","in","the","pipeline",".","stage","(","int",")",":","The","current","stage","."]
docstr: Get the rank of the previous stage.
  
  Returns:
      int: Rank of the previous stage.
docstr_tok: ["Get","the","rank","of","the","previous","stage",".","Returns",":","int",":","Rank","of","the","previous","stage","."]
code: def get_prev_rank(self) -> int:
      """Get the rank of the previous stage.
  
      Returns:
          int: Rank of the previous stage.
      """
      return self.prev_rank
  
file_path: colossalai/colossalai/pipeline/stage_manager.py
imports: import contextlib
  from typing import Dict, List, Optional, Tuple
  import torch.distributed
  from torch.distributed import ProcessGroup
  from colossalai.cluster import ProcessGroupMesh
label_desc: Use image node_id 7 for calling the PipelineStageManager obj's underlying member method code with example usage: obj.get_prev_rank() and returns: self