docstr: Model under test
  conv2d -> avgpool -> hardtanh -> linear
  Check quantization tags on conv2d, avgpool and linear are correctly set
docstr_tok: ["Model","under","test","conv2d","-",">","avgpool","-",">","hardtanh","-",">","linear","Check","quantization","tags","on","conv2d",",","avgpool","and","linear","are","correctly","set"]
code: def test_simple_metadata_porting(self):
      """
      Model under test
      conv2d -> avgpool -> hardtanh -> linear
      Check quantization tags on conv2d, avgpool and linear are correctly set
      """
  
      class BackendAQuantizer(Quantizer):
          def annotate(
              self, gm: torch.fx.GraphModule
          ) -> torch.fx.GraphModule:
              backend_string = "BackendA"
              quantization_config = get_symmetric_quantization_config(
                  is_per_channel=True
              )
              annotated_partitions = OP_TO_ANNOTATOR["linear"](
                  gm, quantization_config
              )
              _tag_partitions(
                  backend_string, "linear", annotated_partitions
              )
              annotated_partitions = OP_TO_ANNOTATOR["conv"](
                  gm, quantization_config
              )
              _tag_partitions(
                  backend_string, "conv2d", annotated_partitions
              )
              annotated_partitions = OP_TO_ANNOTATOR[
                  "adaptive_avg_pool2d"
              ](gm, quantization_config)
              _tag_partitions(
                  backend_string,
                  "adaptive_avg_pool2d",
                  annotated_partitions,
              )
  
          def validate(self, model: torch.fx.GraphModule) -> None:
              pass
  
      example_inputs = (torch.randn(1, 3, 5, 5),)
      get_attr_tags = {
          "BackendA_conv2d_0",
          "BackendA_linear_0",
      }
      quantize_per_tensor_tags = {
          "BackendA_conv2d_0",
          "BackendA_adaptive_avg_pool2d_0",
          "BackendA_linear_0",
      }
      dequantize_per_tensor_tags = {
          "BackendA_adaptive_avg_pool2d_0",
          "BackendA_conv2d_0",
          "BackendA_linear_0",
      }
      dequantize_per_channel_tags = {
          "BackendA_conv2d_0",
          "BackendA_linear_0",
      }
      node_tags = {
          "get_attr": get_attr_tags,
          torch.ops.quantized_decomposed.quantize_per_tensor.default: quantize_per_tensor_tags,
          torch.ops.quantized_decomposed.dequantize_per_tensor.default: dequantize_per_tensor_tags,
          torch.ops.quantized_decomposed.dequantize_per_channel.default: dequantize_per_channel_tags,
      }
      m = self._test_metadata_porting(
          TestHelperModules.Conv2dWithObsSharingOps(),
          example_inputs,
          BackendAQuantizer(),
          node_tags,
      )
  
      from_node_to_tags = {
          torch.ops.aten.adaptive_avg_pool2d.default: "BackendA_adaptive_avg_pool2d_0",
          torch.ops.aten.linear.default: "BackendA_linear_0",
      }
      self._test_quant_tag_preservation_through_decomp(
          m, example_inputs, from_node_to_tags
      )
  
imports: import copy
  import unittest
  from typing import List
  import torch
  import torch._export
  from torch.ao.quantization.quantize_pt2e import convert_pt2e, prepare_pt2e
  from torch.ao.quantization.quantizer import Quantizer
  from torch.ao.quantization.quantizer.xnnpack_quantizer import get_symmetric_quantization_config
  from torch.ao.quantization.quantizer.xnnpack_quantizer_utils import OP_TO_ANNOTATOR
  from torch.fx import Node
  from torch.testing._internal.common_quantization import QuantizationTestCase
  from torch.testing._internal.common_utils import IS_WINDOWS
label_desc: Use image node_id 3 for calling the TestMetaDataPorting obj's underlying member method code with example usage: obj.test_simple_metadata_porting() without return types