code: def _cutlass_moe_testing_helper(
      tokens: int,
      in_channels: int,
      intermediate_dim: int,
      experts: int,
      dtype: int,
      activation_type: ActivationType = ActivationType.GELU,
      use_bias: bool = True,
      iters: int = 1,
  ) -> None:
      config = DSMoEConfig(
          max_tokens=4096,
          model_dim=in_channels,
          intermediate_features=intermediate_dim,
          n_experts=experts,
          activation=activation_type,
          input_dtype=dtype,
          output_dtype=dtype,
      )
  
      implementation_config = {"weight_dtype": DtypeEnum(dtype)}
  
      bundle = ConfigBundle(
          name="cutlass_multi_gemm_moe",
          config=config,
          implementation_config=implementation_config,
      )
      moe_module = DSMoERegistry.instantiate_config(bundle)
  
      batch = build_simple_batch([tokens])
  
      # Parameters
      gate_weight = (
          torch.randn(
              (experts, in_channels),
              dtype=dtype.value,
              device=get_accelerator().current_device(),
          )
          * 0.1
      )
  
      mlp_1_w = (
          torch.randn(
              (experts, intermediate_dim, in_channels),
              dtype=dtype.value,
              device=get_accelerator().current_device(),
          )
          * 0.1
      )
      mlp_2_w = (
          torch.randn(
              (experts, in_channels, intermediate_dim),
              dtype=dtype.value,
              device=get_accelerator().current_device(),
          )
          * 0.1
      )
  
      if use_bias:
          mlp_1_b = (
              torch.randn(
                  (experts, intermediate_dim),
                  dtype=dtype.value,
                  device=get_accelerator().current_device(),
              )
              * 0.1
          )
          mlp_2_b = (
              torch.randn(
                  (experts, in_channels),
                  dtype=dtype.value,
                  device=get_accelerator().current_device(),
              )
              * 0.1
          )
      else:
          mlp_1_b = None
          mlp_2_b = None
  
      gate_ds = moe_module.transform_gate_param(gate_weight)
      mlp_1_w_ds = moe_module.transform_moe_mlp_1_param(mlp_1_w)
      mlp_1_b_ds = moe_module.transform_moe_mlp_1_param(mlp_1_b)
      mlp_2_w_ds = moe_module.transform_moe_mlp_2_param(mlp_2_w)
      mlp_2_b_ds = moe_module.transform_moe_mlp_2_param(mlp_2_b)
  
      for _ in range(iters):
          # Input vals
          hidden_states = (
              torch.randn(
                  (tokens, in_channels),
                  dtype=dtype.value,
                  device=get_accelerator().current_device(),
              )
              * 0.1
          )
  
          # Reference implementation
          ref_output = _reference_impl(
              hidden_states,
              gate_weight,
              mlp_1_w,
              mlp_2_w,
              mlp_1_b,
              mlp_2_b,
              activation_type,
          )
  
          output = moe_module(
              hidden_states,
              batch,
              gate_ds,
              mlp_1_w_ds,
              mlp_2_w_ds,
              mlp_1_b=mlp_1_b_ds,
              mlp_2_b=mlp_2_b_ds,
          )
  
          # Increase the tolerance for larger meta ops since the error is additive
          assert allclose(output, ref_output, tolerances=(1e-2, 1e-2))
  
      get_accelerator().synchronize()
  
file_path: DeepSpeed/tests/unit/inference/v2/modules/test_cutlass_moe.py
imports: from typing import Tuple
  import pytest
  import torch
  from deepspeed.accelerator import get_accelerator
  from deepspeed.inference.v2.inference_utils import ActivationType, DtypeEnum
  from deepspeed.inference.v2.modules import ConfigBundle
  from deepspeed.inference.v2.modules.configs import DSMoEConfig
  from deepspeed.inference.v2.modules.interfaces import DSMoERegistry
  from ..kernels.ragged_ops.ragged_testing_utils import build_simple_batch
  from ...v2.inference_test_utils import allclose, get_dtypes
label_desc: Use image node_id 3 for calling a global function with example usage: _cutlass_moe_testing_helper(tokens, in_channels, intermediate_dim, experts, dtype, activation_type, use_bias, iters) without return types