code: def _find_my_group_index(grouped_ranks):
      """Return the index corresponding to the MoE group of the current process."""
      my_rank = torch.distributed.get_rank()
      for i, group in enumerate(grouped_ranks):
          if my_rank in group:
              return i
      raise RuntimeError(
          f"Unable to find process rank {my_rank} in the set of grouped ranks {grouped_ranks}."
      )
  
imports: import copy
  import functools
  from time import time
  import unittest
  from parameterized import parameterized
  import torch
  from torch import nn
  from torch.optim import SGD, Adadelta, Adam
  from fairscale.fair_dev.testing.testing import dist_init, objects_are_equal, spawn_for_all_world_sizes
  from fairscale.internal.params import recursive_copy_to_device
  from fairscale.nn.data_parallel import FullyShardedDataParallel, get_fsdp_instances
  from fairscale.nn.data_parallel.fsdp_optim_utils import is_singleton_tensor
  from .test_fsdp import DistributedTest, DummyProcessGroup, MixtureOfExperts, TransformerWithSharedParams, rename_test, spawn_and_init
label_desc: Use image node_id 4 for calling a global function with example usage: _find_my_group_index(grouped_ranks) and returns: i