code: def test_topology_3d():
      topo = Topo(axes=["a", "b", "c"], dims=[2, 2, 2])
  
      assert topo.get_rank(a=0, b=0, c=0) == 0
      assert topo.get_rank(a=0, b=0, c=1) == 1
      assert topo.get_rank(a=0, b=1, c=0) == 2
      assert topo.get_rank(a=0, b=1, c=1) == 3
      assert topo.get_rank(a=1, b=0, c=0) == 4
      assert topo.get_rank(a=1, b=0, c=1) == 5
      assert topo.get_rank(a=1, b=1, c=0) == 6
      assert topo.get_rank(a=1, b=1, c=1) == 7
  
      assert topo.get_axis_list("a", 0) == [0, 1, 2, 3]
      assert topo.get_axis_list("a", 1) == [4, 5, 6, 7]
      assert topo.get_axis_list("b", 0) == [0, 1, 4, 5]
      assert topo.get_axis_list("b", 1) == [2, 3, 6, 7]
      assert topo.get_axis_list("c", 0) == [0, 2, 4, 6]
      assert topo.get_axis_list("c", 1) == [1, 3, 5, 7]
  
      assert topo.get_coord(0) == topo.ProcessCoord(0, 0, 0)
      assert topo.get_coord(1) == topo.ProcessCoord(0, 0, 1)
      assert topo.get_coord(2) == topo.ProcessCoord(0, 1, 0)
      assert topo.get_coord(3) == topo.ProcessCoord(0, 1, 1)
      assert topo.get_coord(4) == topo.ProcessCoord(1, 0, 0)
      assert topo.get_coord(5) == topo.ProcessCoord(1, 0, 1)
      assert topo.get_coord(6) == topo.ProcessCoord(1, 1, 0)
      assert topo.get_coord(7) == topo.ProcessCoord(1, 1, 1)
  
      assert topo.filter_match(a=0) == [0, 1, 2, 3]
      assert topo.filter_match(b=1, c=1) == [3, 7]
      assert topo.filter_match(a=1, b=1, c=1) == [7]
  
      # Easy access method
      assert topo.get_coord(0).a == 0
  
file_path: DeepSpeed/tests/unit/runtime/pipe/test_topology.py
imports: import pytest
  import torch
  import deepspeed.comm
  from deepspeed.runtime.pipe.topology import PipelineParallelGrid
  from deepspeed.runtime.pipe.topology import ProcessTopology
  from deepspeed.runtime.pipe.topology import _prime_factors
  from deepspeed.accelerator import get_accelerator
  from unit.common import DistributedTest
label_desc: Use image node_id 5 for calling a global function with example usage: test_topology_3d() without return types