docstr: Test to make sure the get_attr node for const propagated weight Tensor gets the correct
  metadata (from original get_attr node from weight)
docstr_tok: ["Test","to","make","sure","the","get_attr","node","for","const","propagated","weight","Tensor","gets","the","correct","metadata","(","from","original","get_attr","node","from","weight",")"]
code: def test_constant_prop_preserve_metadata(self):
      """Test to make sure the get_attr node for const propagated weight Tensor gets the correct
      metadata (from original get_attr node from weight)
      """
  
      class M(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.linear = torch.nn.Linear(2, 2)
  
          def forward(self, x):
              return self.linear(x)
  
      quantizer = XNNPACKQuantizer()
      operator_config = get_symmetric_quantization_config()
      quantizer.set_global(operator_config)
      example_inputs = (torch.randn(2, 2),)
      m = M().eval()
      m = capture_pre_autograd_graph(
          m,
          example_inputs,
      )
      weight_meta = None
      for n in m.graph.nodes:
          if (
              n.op == "get_attr"
              and next(iter(n.users)).target
              == torch.ops.aten.linear.default
          ):
              weight_meta = n.meta
              break
      assert (
          weight_meta is not None
      ), "Expect to find metadata for weight node"
  
      m = prepare_pt2e(m, quantizer)
      m(*example_inputs)
      m = convert_pt2e(m, fold_quantize=True)
  
      for n in m.graph.nodes:
          if n.op == "get_attr" and "frozen_param" in n.target:
              self.assertIn("stack_trace", n.meta)
              for key in n.meta:
                  self.assertEqual(n.meta[key], weight_meta[key])
  
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 17 for calling the TestQuantizePT2E obj's underlying member method code with example usage: obj.test_constant_prop_preserve_metadata() and returns: self