code: def export_ls_decoder(
      file,
      state_dict,
      hidden_size,
      intermediate_size,
      nlayer,
      save_pb=True,
  ):
      hs, ims = hidden_size, intermediate_size
      offsets = LSTransformerDecoderLayer.gen_offset(hs, ims, nlayer)
      mapping_dict = OrderedDict(
          {
              "self_project_kernel_qkv": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[0], offsets[1], 3 * hs, hs
              ),
              "self_project_bias_qkv": "para&&expression_[{0}:{1}]".format(
                  offsets[1], offsets[2]
              ),
              "self_project_kernel_output": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[2], offsets[3], hs, hs
              ),
              "self_project_bias_output": "para&&expression_[{0}:{1}]".format(
                  offsets[3], offsets[4]
              ),
              "self_norm_scale": "para&&expression_[{0}:{1}]".format(
                  offsets[4], offsets[5]
              ),
              "self_norm_bias": "para&&expression_[{0}:{1}]".format(
                  offsets[5], offsets[6]
              ),
              "encdec_project_kernel_q": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[6], offsets[7], hs, hs
              ),
              "encdec_project_bias_q": "para&&expression_[{0}:{1}]".format(
                  offsets[7], offsets[8]
              ),
              "encdec_project_kernel_output": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[8], offsets[9], hs, hs
              ),
              "encdec_project_bias_output": "para&&expression_[{0}:{1}]".format(
                  offsets[9], offsets[10]
              ),
              "encdec_norm_scale": "para&&expression_[{0}:{1}]".format(
                  offsets[10], offsets[11]
              ),
              "encdec_norm_bias": "para&&expression_[{0}:{1}]".format(
                  offsets[11], offsets[12]
              ),
              "ffn_first_kernel": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[12], offsets[13], ims, hs
              ),
              "ffn_first_bias": "para&&expression_[{0}:{1}]".format(
                  offsets[13], offsets[14]
              ),
              "ffn_second_kernel": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[14], offsets[15], hs, ims
              ),
              "ffn_second_bias": "para&&expression_[{0}:{1}]".format(
                  offsets[15], offsets[16]
              ),
              "ffn_norm_scale": "para&&expression_[{0}:{1}]".format(
                  offsets[16], offsets[17]
              ),
              "ffn_norm_bias": "para&&expression_[{0}:{1}]".format(
                  offsets[17], offsets[18]
              ),
          }
      )
      enc_out_mapping_dict = OrderedDict(
          {
              "encode_output_project_kernel_kv": "para&&expression_[{0}:{1}].reshape({2}, {3}).transpose(0, 1)".format(
                  offsets[19], offsets[20], 2 * nlayer * hs, hs
              ),
              "encode_output_project_bias_kv": "para&&expression_[{0}:{1}]".format(
                  offsets[20], offsets[21]
              ),
          }
      )
      fill_encdec_weight(
          file,
          state_dict,
          mapping_dict,
          False,
          save_pb,
          enc_out_mapping_dict,
      )
  
file_path: lightseq/lightseq/training/ops/pytorch/export.py
imports: from collections import OrderedDict
  import numpy
  from lightseq.training.ops.pytorch.util import get_pos_embedding
  from lightseq.training import LSTransformerEncoderLayer, LSTransformerDecoderLayer
label_desc: Use image node_id 8 for calling a global function with example usage: export_ls_decoder(file, state_dict, hidden_size, intermediate_size, nlayer, save_pb) without return types