code: def init_weight(weight: np.ndarray,
                  vocab_in: Dict[str, int],
                  vocab_out: Dict[str, int],
                  initializer: mx.initializer.Initializer=mx.init.Constant(value=0.0)) -> mx.nd.NDArray:
      
      shape = list(weight.shape)
      shape[0] = len(vocab_out)
      weight_init = mx.nd.empty(tuple(shape), dtype='float32')
      weight_desc = mx.init.InitDesc("vocabulary_sized_weight")
      initializer(weight_desc, weight_init)
      for token in vocab_out:
          if token in vocab_in:
              weight_init[vocab_out[token]] = weight[vocab_in[token]]
      return weight_init
docs: Initialize vocabulary-sized weight by existing values given input and output vocabularies.
  
      :param weight: Input weight.
      :param vocab_in: Input vocabulary.
      :param vocab_out: Output vocabulary.
      :param initializer: MXNet initializer.
      :return: Initialized output weight.