code: def initialize_parameters(module: pt.nn.Module):
      """
      Can be applied to a SockeyeModel (via `model.apply(initialize_parameters)`)
      to initialize the parameters of a PyTorch SockeyeModel.
      For reproducibility, set pt.random.manual_seed.
  
      This implementation follows the default MXNet initialization scheme:
      - linear/feed-forward weights: Xavier(uniform, avg, magnitude=3.0)
      - biases: 0.0
      - layer norm gamma / weight: 1.0
      - layer norm beta / bias: 0.0
      - embedding parameters: uniform(-0.07, 0.07) [matches MXNet's default initialization]
  
      MXNet computes the uniform bounds for Xavier initialization as follows:
        sqrt(3 / ((fan_in + fan_out) / 2))
      PyTorch computes the uniform bounds for Xavier initialization as follows:
        (sqrt(2/(fan_in + fan_out)) * gain) * sqrt(3)
        where gain is set to 1.0 by default
      Both are equivalent.
      For some background on the equivalence of mx.init.Xavier and pt.nn.init.xavier_uniform_, see
      https://jamesmccaffrey.wordpress.com/2020/11/20/the-gain-parameter-
      """
      if isinstance(module, pt.nn.Linear) or isinstance(
          module, layers.OutputLayer
      ):
          pt.nn.init.xavier_uniform_(module.weight, gain=1)
          if module.bias is not None:
              pt.nn.init.zeros_(module.bias)
      elif isinstance(module, pt.nn.Embedding):
          pt.nn.init.uniform_(module.weight, -0.07, 0.07)
      elif isinstance(module, pt.nn.LayerNorm):
          if module.elementwise_affine:
              pt.nn.init.ones_(module.weight)
              pt.nn.init.zeros_(module.bias)
      elif isinstance(module, layers.LHUC):
          pt.nn.init.uniform_(module.weight, a=0.1)
      elif isinstance(module, layers.PositionalEmbeddings):
          if module.weight_type == C.LEARNED_POSITIONAL_EMBEDDING:
              pt.nn.init.xavier_uniform(module.weight, gain=1.0)
  
imports: import copy
  import logging
  import os
  import time
  from dataclasses import dataclass
  from functools import lru_cache
  from typing import cast, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from sockeye import __version__
  from .None import constants
  from .None import data_io
  from .None import decoder
  from .None import encoder
  from .None import layers
  from .None import transformer
  from .None import utils
  from .None import vocab
  from .config import Config
  from .encoder import FactorConfig
  from .layers import LengthRatioConfig
  from .None import nvs
  from sockeye.knn import KNNConfig
label_desc: Use image node_id 1 for calling a global function with example usage: initialize_parameters(module) without return types