code: def quantize_tensorrt(
      quantization_type: QuantizationType,
      model_params: ModelParams,
      config,
      input_tfms: MultiStageTransformation,
      input_data: List[Tuple[np.ndarray, ...]] = None,
  ):
      if quantization_type is QuantizationType.HALF:
          config.set_flag(trt.BuilderFlag.FP16)
          # Tensor RT does not need to transform input data
          # to fp16 because it expects always fp32
      elif quantization_type is QuantizationType.STATIC:
          assert input_data is not None, (
              "You need to specify the calibration data for "
              "performing static quantization."
          )
          calibrator = TensorRTCalibrator(
              batch_size=model_params.batch_size,
              input_data=input_data,
          )
          config.set_flag(trt.BuilderFlag.INT8)
          config.int8_calibrator = calibrator
  
      return config
  
file_path: nebuly/optimization/nebullvm/nebullvm/operations/optimizations/compilers/quantizations/tensor_rt.py
imports: from typing import List, Tuple
  import numpy
  from nebullvm.core.models import QuantizationType, ModelParams
  from nebullvm.optional_modules.tensor_rt import tensorrt, IInt8EntropyCalibrator2, polygraphy
  from nebullvm.tools.transformations import MultiStageTransformation
label_desc: Use image node_id 1 for calling a global function with example usage: quantize_tensorrt(quantization_type, model_params, config, input_tfms, input_data) and returns: config