code: def test_qat_quantization_speedup(self):
      model = BackboneModel()
  
      configure_list = [
          {
              "quant_types": ["input", "weight"],
              "quant_bits": {"input": 8, "weight": 8},
              "op_names": ["conv1"],
          },
          {
              "quant_types": ["output"],
              "quant_bits": {"output": 8},
              "op_names": ["relu1"],
          },
          {
              "quant_types": ["input", "weight"],
              "quant_bits": {"input": 8, "weight": 8},
              "op_names": ["conv2"],
          },
          {
              "quant_types": ["output"],
              "quant_bits": {"output": 8},
              "op_names": ["relu2"],
          },
      ]
  
      # finetune the model by using QAT
      dummy_input = torch.randn(1, 1, 28, 28)
      optimizer = torch.optim.SGD(
          model.parameters(), lr=0.01, momentum=0.5
      )
      quantizer = QATQuantizer(
          model, configure_list, optimizer, dummy_input
      )
      quantizer.compress()
  
      model.to(self.device)
      for epoch in range(1):
          print("# Epoch {} #".format(epoch))
          self._train(model, optimizer)
          self._test(model)
  
      model_path = "mnist_model.pth"
      calibration_path = "mnist_calibration.pth"
      calibration_config = quantizer.export_model(
          model_path, calibration_path
      )
  
      self._test(model)
  
      print("calibration_config: ", calibration_config)
  
      batch_size = 32
      input_shape = (batch_size, 1, 28, 28)
  
      engine = ModelSpeedupTensorRT(
          model,
          input_shape,
          config=calibration_config,
          batchsize=batch_size,
      )
      engine.compress()
  
      self._test_trt(engine)
  
      os.remove(model_path)
      os.remove(calibration_path)
  
imports: import os
  import torch
  import torch.nn.functional
  from torchvision.models.vgg import vgg16
  from torchvision import datasets, transforms
  import unittest
  from unittest import TestCase, main
  from nni.compression.quantization import QATQuantizer
  from nni.compression.quantization_speedup import ModelSpeedupTensorRT
label_desc: Use image node_id 6 for calling the QuantizationSpeedupTestCase obj's underlying member method code with example usage: obj.test_qat_quantization_speedup() without return types