class_docstr: Make the FMoETransformerMLP layer that distributes experts across
  communication group `group` to replace the original MLP layer in Megatron.
class_docstr_tok: ["Make","the","FMoETransformerMLP","layer","that","distributes","experts","across","communication","group","`","group","`","to","replace","the","original","MLP","layer","in","Megatron","."]
docstr: Initialize the weight as linear layers.
  As megatron is using fixed random seed for some nasty stuff, an
  additional numpy rng is used.
docstr_tok: ["Initialize","the","weight","as","linear","layers",".","As","megatron","is","using","fixed","random","seed","for","some","nasty","stuff",",","an","additional","numpy","rng","is","used","."]
code: def reset_parameters(self):
      r"""
      Initialize the weight as linear layers.
      As megatron is using fixed random seed for some nasty stuff, an
      additional numpy rng is used.
      """
      rng = np.random.default_rng(np.random.randint(2048) + self.rank)
  
      if type(self.experts) is nn.ModuleList:
          for expert in self.experts:
              _megatron_init_method(expert.htoh4, rng, self.sigma)
      else:
          _megatron_init_method(self.experts.htoh4, rng, self.sigma)
  
      std = self.sigma / math.sqrt(2.0 * self.num_layers)
  
      if type(self.experts) is nn.ModuleList:
          for expert in self.experts:
              _megatron_init_method(expert.h4toh, rng, std)
      else:
          _megatron_init_method(self.experts.h4toh, rng, std)
  
file_path: smart-moe/fmoe/megatron/layers.py
imports: import math
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from fmoe.transformer import FMoETransformerMLP
  from .balance import reset_gate_hook
  from .balance import generate_megatron_gate_hook
label_desc: Use image node_id 2 for calling the MegatronMLP obj's underlying member method code with example usage: obj.reset_parameters() without return types