code: def fill_quant_hdf5_layer(
      tensor_names,
      state_dict,
      hdf5_file,
      hdf5_dataset_prefix,
      mapping_dict,
  ):
      for proto_name, ckpt_rule in mapping_dict.items():
          target_tensor = apply_rule(
              proto_name, ckpt_rule, tensor_names, state_dict
          )
          if proto_name.endswith("_clip_max"):
              hdf5_file.create_dataset(
                  hdf5_dataset_prefix + proto_name,
                  data=float(target_tensor[0]),
              )
          else:
              hdf5_file.create_dataset(
                  hdf5_dataset_prefix + proto_name,
                  data=target_tensor,
              )
  
file_path: lightseq/examples/inference/python/export/huggingface/ls_torch_hf_quant_bert_export.py
imports: import os
  import h5py
  from collections import OrderedDict
  import torch
  from lightseq.training.ops.pytorch.export import apply_rule
  from lightseq.training.ops.pytorch.export_quant import quantize
  from export.util import parse_args
label_desc: Use image node_id 1 for calling a global function with example usage: fill_quant_hdf5_layer(tensor_names, state_dict, hdf5_file, hdf5_dataset_prefix, mapping_dict) without return types