code: def transfer_lstm(ch_lstm, th_lstm):
      ch_lstm.upward.W.data[:] = 1
      th_lstm.weight_ih.data[:] = torch.from_numpy(
          ch_lstm.upward.W.data
      )
      ch_lstm.upward.b.data[:] = 1
      th_lstm.bias_hh.data[:] = torch.from_numpy(ch_lstm.upward.b.data)
      # NOTE: only lateral weight can directly transfer
      # rest of the weights and biases have quite different placements
      th_lstm.weight_hh.data[:] = torch.from_numpy(
          ch_lstm.lateral.W.data
      )
      th_lstm.bias_ih.data.zero_()
  
file_path: espnet/test/test_lm.py
imports: from test.test_beam_search import prepare, rnn_args
  import chainer
  import numpy
  import pytest
  import torch
  import espnet.lm.chainer_backend.lm
  import espnet.nets.pytorch_backend.lm.default
  from espnet.nets.beam_search import beam_search
  from espnet.nets.lm_interface import dynamic_import_lm
  from espnet.nets.scorers.length_bonus import LengthBonus
label_desc: Use image node_id 1 for calling a global function with example usage: transfer_lstm(ch_lstm, th_lstm) without return types