code: def apply_precision_to_layer(layer, config):
      if "weight_bits" in config:
          w_bits = config["weight_bits"]
          layer.precision = Precision_Dict[w_bits]
      if "input_bits" in config:
          assert "tracked_min_input" in config
          assert "tracked_max_input" in config
          tracked_min_input = config["tracked_min_input"]
          tracked_max_input = config["tracked_max_input"]
          # NOTE: only support one input tensor for now
          in_tensor = layer.get_input(0)
          in_tensor.dynamic_range = (
              tracked_min_input,
              tracked_max_input,
          )
      if "output_bits" in config:
          assert "tracked_min_output" in config
          assert "tracked_max_output" in config
          act_bits = config["output_bits"]
          tracked_min_output = config["tracked_min_output"]
          tracked_max_output = config["tracked_max_output"]
          layer.set_output_type(0, Precision_Dict[act_bits])
          out_tensor = layer.get_output(0)
          out_tensor.dynamic_range = (
              tracked_min_output,
              tracked_max_output,
          )
  
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 4 for calling a global function with example usage: apply_precision_to_layer(layer, config) without return types