code: def test_float_quant_compare_per_tensor(self):
      for qengine in supported_qengines:
          with override_quantized_engine(qengine):
              torch.manual_seed(42)
              my_model = ModelMultipleOps().to(torch.float32)
              my_model.eval()
              calib_data = torch.rand(
                  1024, 3, 15, 15, dtype=torch.float32
              )
              eval_data = torch.rand(1, 3, 15, 15, dtype=torch.float32)
              out_ref = my_model(eval_data)
              qModel = torch.ao.quantization.QuantWrapper(my_model)
              qModel.eval()
              qModel.qconfig = torch.ao.quantization.default_qconfig
              torch.ao.quantization.fuse_modules(
                  qModel.module,
                  [["conv1", "bn1", "relu1"]],
                  inplace=True,
              )
              torch.ao.quantization.prepare(qModel, inplace=True)
              qModel(calib_data)
              torch.ao.quantization.convert(qModel, inplace=True)
              out_q = qModel(eval_data)
              SQNRdB = 20 * torch.log10(
                  torch.norm(out_ref) / torch.norm(out_ref - out_q)
              )
              # Quantized model output should be close to floating point model output numerically
              # Setting target SQNR to be 30 dB so that relative error is 1e-3 below the desired
              # output
              self.assertGreater(
                  SQNRdB,
                  30,
                  msg="Quantized model numerics diverge from float, expect SQNR > 30 dB",
              )
  
file_path: pytorch/test/quantization/eager/test_model_numerics.py
imports: import torch
  from torch.testing._internal.common_quantization import QuantizationTestCase, ModelMultipleOps, ModelMultipleOpsNoAvgPool
  from torch.testing._internal.common_quantized import override_quantized_engine, supported_qengines
label_desc: Use image node_id 1 for calling the TestModelNumericsEager obj's underlying member method code with example usage: obj.test_float_quant_compare_per_tensor() without return types