code: def _handle_gemm(layer, config, out2layer, in2layer):
      """
      Gemm is special case. the following is the graph structure of Gemm in trt's graph
      input                       ->| Gemm  ->| ElementWise
      LayerType.Constant (weight) ->|
      LayerType.Constant (bias) -> Shuffle  ->|
      assume quantize input, output, and weight
      """
      w_bits = config["weight_bits"]
      layer.precision = Precision_Dict[w_bits]
      # handle the input tensor
      in_tensor = layer.get_input(0)
      in_tensor.dynamic_range = (
          config["tracked_min_input"],
          config["tracked_max_input"],
      )
      # handle the output tensor
      out_tensor = layer.get_output(0)
      out_tensor.dynamic_range = (
          config["tracked_min_output"],
          config["tracked_max_output"],
      )
      # handle weight
      w_in_tensor = layer.get_input(1)
      weight_layer = out2layer[w_in_tensor.name]
      assert weight_layer.type == trt.LayerType.CONSTANT
      weight_layer.precision = Precision_Dict[w_bits]
      weight_layer.set_output_type(0, Precision_Dict[w_bits])
      w_out_tensor = weight_layer.get_output(0)
      w_out_tensor.dynamic_range = (
          config["min_weight"],
          config["max_weight"],
      )
      print("special gemm: ", w_out_tensor.dynamic_range)
      # TODO: handle sum & bias
      # NOTE: a feasible way is setting bias to 0 in quantization algorithm size
      # and track the dynamic range without bias.
      return weight_layer.name
  
imports: import time
  import logging
  import tensorrt
  import numpy
  import torch
  from .None import frontend_to_onnx
  from .None import trt_pycuda
  from .backend import BaseModelSpeedup
label_desc: Use image node_id 3 for calling a global function with example usage: _handle_gemm(layer, config, out2layer, in2layer) and returns: weight_layer