class_docstr: Parameters
  ----------
  model : pytorch model
      The model to speedup by quantization.
  input_shape : tuple
      The input shape of the model, shall pass it to torch.onnx.export.
      Note, the batch size of input_shape is the inference batch of the created trt engine,
      it should be equal to the batch size of running test with the engine.
  config : dict
      Config recording bits number and name of layers.
  onnx_path : str
      The path user want to store onnx model which is converted from pytorch model.
docstr: This speedup approach uses ```trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS``` mode of trt engine,
  which means it would faithfully enforce the precisions and dynamic ranges
  in user passed-in config i.e., self.config.
  Thus, users must provide dynamic range for all tensors that are not Int32 or Bool.
docstr_tok: ["This","speedup","approach","uses","``","`","trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS","``","`","mode","of","trt","engine",",","which","means","it","would","faithfully","enforce","the","precisions","and","dynamic","ranges","in","user","passed-in","config","i.e.",",","self.config",".","Thus",",","users","must","provide","dynamic","range","for","all","tensors","that","are","not","Int32","or","Bool","."]
code: def compress(self):
      """
      This speedup approach uses ```trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS``` mode of trt engine,
      which means it would faithfully enforce the precisions and dynamic ranges
      in user passed-in config i.e., self.config.
      Thus, users must provide dynamic range for all tensors that are not Int32 or Bool.
      """
      assert self.config is not None
      # Convert pytorch model to onnx model and save onnx model in onnx_path
      _, onnx_config = fonnx.torch_to_onnx(
          self.model,
          self.config,
          input_shape=self.input_shape,
          model_path=self.onnx_path,
          input_names=self.input_names,
          output_names=self.output_names,
      )
      valid_config(onnx_config)
      self.engine = build_engine_without_calib(
          self.onnx_path, onnx_config
      )
  
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 2 for calling the ModelSpeedupTensorRT obj's underlying member method code with example usage: obj.compress() without return types