docstr: Test we can safely call quantization apis multiple times
docstr_tok: ["Test","we","can","safely","call","quantization","apis","multiple","times"]
code: def test_reentrant(self):
      """Test we can safely call quantization apis multiple times"""
      m = TestHelperModules.ConvBnReLU2dAndLinearReLU()
      example_inputs = (torch.randn(3, 3, 10, 10),)
  
      quantizer = XNNPACKQuantizer().set_global(
          get_symmetric_quantization_config(
              is_per_channel=True, is_qat=True
          )
      )
      m.conv_bn_relu = capture_pre_autograd_graph(
          m.conv_bn_relu, example_inputs
      )
      m.conv_bn_relu = prepare_qat_pt2e(m.conv_bn_relu, quantizer)
      m(*example_inputs)
      m.conv_bn_relu = convert_pt2e(m.conv_bn_relu, fold_quantize=True)
  
      quantizer = XNNPACKQuantizer().set_module_type(
          torch.nn.Linear,
          get_symmetric_quantization_config(is_per_channel=False),
      )
      m = capture_pre_autograd_graph(m, example_inputs)
      m = prepare_pt2e(m, quantizer)
      m = convert_pt2e(m, fold_quantize=True)
  
      node_occurrence = {
          ns.call_function(
              torch.ops.quantized_decomposed.quantize_per_tensor.default
          ): 4,
          # one for weight
          ns.call_function(
              torch.ops.quantized_decomposed.dequantize_per_tensor.default
          ): 5,
          ns.call_function(
              torch.ops.quantized_decomposed.dequantize_per_channel.default
          ): 1,
      }
      node_list = [
          ns.call_function(
              torch.ops.quantized_decomposed.dequantize_per_tensor.default
          ),
          ns.call_function(torch.ops.aten.conv2d.default),
          ns.call_function(torch.ops.aten.relu.default),
          ns.call_function(
              torch.ops.quantized_decomposed.quantize_per_tensor.default
          ),
          ns.call_function(
              torch.ops.quantized_decomposed.dequantize_per_tensor.default
          ),
          ns.call_function(torch.ops.aten.linear.default),
          ns.call_function(
              torch.ops.quantized_decomposed.quantize_per_tensor.default
          ),
      ]
      self.checkGraphModuleNodes(
          m,
          expected_node_occurrence=node_occurrence,
          expected_node_list=node_list,
      )
  
imports: from typing import List, Tuple
  import torch
  from torch._export import capture_pre_autograd_graph
  from torch import Tensor
  from torch.ao.quantization import observer, ObserverOrFakeQuantize, QConfigMapping
  from torch.ao.quantization.quantizer import DerivedQuantizationSpec, FixedQParamsQuantizationSpec, QuantizationAnnotation, QuantizationSpec, Quantizer, SharedQuantizationSpec
  from torch.ao.quantization.quantizer.xnnpack_quantizer import XNNPACKQuantizer, get_symmetric_quantization_config
  from torch.ao.quantization.quantizer.xnnpack_quantizer_utils import OP_TO_ANNOTATOR, QuantizationConfig
  from torch.ao.quantization.quantizer.composable_quantizer import ComposableQuantizer
  from torch.ao.quantization.quantizer.embedding_quantizer import EmbeddingQuantizer
  from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e, prepare_qat_pt2e
  from torch.ao.quantization.qconfig import default_per_channel_symmetric_qnnpack_qconfig, float_qparams_weight_only_qconfig, per_channel_weight_observer_range_neg_127_to_127, QConfig, weight_observer_range_neg_127_to_127
  from torch.fx import Node
  from torch.testing._internal.common_quantization import NodeSpec, PT2EQuantizationTestCase, skipIfNoQNNPACK, TestHelperModules
  from torch.testing._internal.common_utils import TemporaryFileName
label_desc: Use image node_id 28 for calling the TestQuantizePT2E obj's underlying member method code with example usage: obj.test_reentrant() without return types