class_docstr: MoE Parameter for a gated activation function in which the gating matrix is not
  fused in the same parameter as the non-gating matrix.
  
  This is a stacked version of the ``GatedMLPParameter``. Please see that class for more
  documentation on the layout of the parameters.
class_docstr_tok: ["MoE","Parameter","for","a","gated","activation","function","in","which","the","gating","matrix","is","not","fused","in","the","same","parameter","as","the","non-gating","matrix",".","This","is","a","stacked","version","of","the","``","GatedMLPParameter","``",".","Please","see","that","class","for","more","documentation","on","the","layout","of","the","parameters","."]
code: def finalize(self) -> torch.Tensor:
      transposed_experts = []
      for gate, up in zip(self.gating_experts, self.up_experts):
          assert (
              gate.shape[0] == up.shape[0]
          ), "Gated MLP parameters must have the same number of neurons."
          total_neurons = gate.shape[0] + up.shape[0]
          fused_expert = torch.cat([gate, up], dim=-1).reshape(
              total_neurons, -1
          )
          transposed_experts.append(fused_expert)
  
      stacked_experts = torch.stack(transposed_experts, dim=0)
      return self.inference_model.transform_moe_mlp_1_param(
          stacked_experts
      )
  
file_path: DeepSpeed/deepspeed/inference/v2/model_implementations/common_parameters/moe_parameters.py
imports: import torch
  from ...model_implementations.parameter_base import ParameterBase, ParamList
label_desc: Use image node_id 1 for calling the UnfusedMoEGatedMLPParameter obj's underlying member method code with example usage: obj.finalize() and returns: self