code: def init(textCNN, vocab, model_mode, context, lr):
      
  
      textCNN.initialize(mx.init.Xavier(), ctx=context, force_reinit=True)
      if model_mode != 'rand':
          textCNN.embedding.weight.set_data(vocab.embedding.idx_to_vec)
      if model_mode == 'multichannel':
          textCNN.embedding_extend.weight.set_data(vocab.embedding.idx_to_vec)
      if model_mode == 'static' or model_mode == 'multichannel':
          # Parameters of textCNN.embedding are not updated during training.
          textCNN.embedding.collect_params().setattr('grad_req', 'null')
      trainer = gluon.Trainer(textCNN.collect_params(), 'adam', {'learning_rate': lr})
      return textCNN, trainer
docs: Initialize parameters.