code: def test_feedforward(
      feedforward_name: str,
      activation: Activation,
      device: torch.device,
  ):
      test_config = {
          "name": feedforward_name,
          "dim_model": LATENT,
          "dropout": DROPOUT,
          "activation": activation,
          "hidden_layer_multiplier": 4,
          "number_of_experts": 4,  # MoE
          "gate": "top_2",  # MoE
      }
  
      if feedforward_name == "MixtureOfExperts":
          init_torch_distributed_local()
  
      # dummy, just check construction and dimensions in the FW pass
      ffw = build_feedforward(test_config)
  
      if ffw.requires_cuda and not device.type == "cuda":
          # pyre-fixme[29]: The library function `pytest.skip` is not supported by Pyre.
          pytest.skip(
              "This MLP requires CUDA and current device does not match"
          )
  
      inputs = torch.rand(BATCH, SEQ, LATENT, device=device)
      ffw = ffw.to(device)
  
      _ = ffw(inputs)
  
file_path: xformers/tests/test_feedforward.py
imports: import pytest
  import torch
  from xformers.components import Activation
  from xformers.components.feedforward import FEEDFORWARD_REGISTRY, build_feedforward
  from xformers.components.feedforward.mixture_of_experts import GateConfig
  from xformers.helpers.test_utils import init_torch_distributed_local
label_desc: Use image node_id 1 for calling a global function with example usage: test_feedforward(feedforward_name, activation, device) without return types