docstr: Tests that the modified model for equalization has the same graph
  structure as the model without equalization (before and after
  quantization).
docstr_tok: ["Tests","that","the","modified","model","for","equalization","has","the","same","graph","structure","as","the","model","without","equalization","(","before","and","after","quantization",")","."]
code: def test_input_weight_equalization_graphs(self):
      """Tests that the modified model for equalization has the same graph
      structure as the model without equalization (before and after
      quantization).
      """
  
      linear_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nnq.Linear),
          ns.call_method("dequantize"),
      ]
  
      linearAdd_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nnq.Linear),
          ns.call_method("dequantize"),
          ns.call_function(torch.add),
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nnq.Linear),
          ns.call_method("dequantize"),
      ]
  
      linear2_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nnq.Linear),
          ns.call_module(nnq.Linear),
          ns.call_method("dequantize"),
      ]
  
      functionalLinear_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.linear),
          ns.call_method("dequantize"),
      ]
  
      functionalLinearAdd_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.linear),
          ns.call_method("dequantize"),
          ns.call_function(torch.add),
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.linear),
          ns.call_method("dequantize"),
      ]
  
      functionalLinear2_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.linear),
          ns.call_function(torch.ops.quantized.linear),
          ns.call_method("dequantize"),
      ]
  
      linearRelu_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nniq.LinearReLU),
          ns.call_method("dequantize"),
      ]
  
      linearReluLinear_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nniq.LinearReLU),
          ns.call_module(nnq.Linear),
          ns.call_method("dequantize"),
      ]
  
      functionalLinearRelu_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.linear_relu),
          ns.call_method("dequantize"),
      ]
  
      functionalLinearReluLinear_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.linear_relu),
          ns.call_function(torch.ops.quantized.linear),
          ns.call_method("dequantize"),
      ]
  
      conv_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nnq.Conv2d),
          ns.call_method("dequantize"),
      ]
  
      conv2_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nnq.Conv2d),
          ns.call_module(nnq.Conv2d),
          ns.call_method("dequantize"),
      ]
  
      functionalConv_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.conv2d),
          ns.call_method("dequantize"),
      ]
  
      functionalConv2_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.conv2d),
          ns.call_function(torch.ops.quantized.conv2d),
          ns.call_method("dequantize"),
      ]
  
      convRelu_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nniq.ConvReLU2d),
          ns.call_method("dequantize"),
      ]
  
      convReluConv_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_module(nniq.ConvReLU2d),
          ns.call_module(nnq.Conv2d),
          ns.call_method("dequantize"),
      ]
  
      functionalConvRelu_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.conv2d_relu),
          ns.call_method("dequantize"),
      ]
  
      functionalConvReluConv_node_list = [
          ns.call_function(torch.mul),
          ns.call_function(torch.quantize_per_tensor),
          ns.call_function(torch.ops.quantized.conv2d_relu),
          ns.call_function(torch.ops.quantized.conv2d),
          ns.call_method("dequantize"),
      ]
  
      tests = [
          (SingleLayerLinearModel, linear_node_list),
          (LinearAddModel, linearAdd_node_list),
          (TwoLayerLinearModel, linear2_node_list),
          (
              SingleLayerFunctionalLinearModel,
              functionalLinear_node_list,
          ),
          (FunctionalLinearAddModel, functionalLinearAdd_node_list),
          (TwoLayerFunctionalLinearModel, functionalLinear2_node_list),
          (LinearReluModel, linearRelu_node_list),
          (LinearReluLinearModel, linearReluLinear_node_list),
          (FunctionalLinearReluModel, functionalLinearRelu_node_list),
          (
              FunctionalLinearReluLinearModel,
              functionalLinearReluLinear_node_list,
          ),
          (ConvModel, conv_node_list),
          (TwoLayerConvModel, conv2_node_list),
          (SingleLayerFunctionalConvModel, functionalConv_node_list),
          (TwoLayerFunctionalConvModel, functionalConv2_node_list),
          (ConvReluModel, convRelu_node_list),
          (ConvReluConvModel, convReluConv_node_list),
          (FunctionalConvReluModel, functionalConvRelu_node_list),
          (
              FunctionalConvReluConvModel,
              functionalConvReluConv_node_list,
          ),
      ]
  
      for M, node_list in tests:
          m = M().eval()
          example_inputs = m.get_example_inputs()
          prepared = prepare_fx(
              m,
              specific_qconfig_dict,
              example_inputs=example_inputs,
              _equalization_config=default_equalization_qconfig_dict,
          )
          equalized_quantized_model = convert_fx(prepared)
  
          # Check the order of nodes in the graph
          self.checkGraphModuleNodes(
              equalized_quantized_model, expected_node_list=node_list
          )
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import torch.ao.nn.intrinsic.quantized
  import torch.ao.nn.quantized
  from torch.ao.quantization import default_qconfig
  from torch.ao.quantization.observer import MinMaxObserver, PerChannelMinMaxObserver
  from torch.ao.quantization.quantize_fx import prepare_fx, convert_fx
  from torch.ao.quantization.fx._equalize import _InputEqualizationObserver, _WeightEqualizationObserver, calculate_equalization_scale, default_equalization_qconfig, _convert_equalization_ref, get_layer_sqnr_dict, get_equalization_qconfig_dict
  from torch.testing._internal.common_quantization import NodeSpec, QuantizationTestCase, SingleLayerLinearModel, TwoLayerLinearModel, LinearAddModel, SingleLayerFunctionalLinearModel, TwoLayerFunctionalLinearModel, FunctionalLinearAddModel, ConvModel, TwoLayerConvModel, SingleLayerFunctionalConvModel, TwoLayerFunctionalConvModel, skipIfNoFBGEMM, LinearReluModel, LinearReluLinearModel, LinearReluAddModel, FunctionalLinearReluModel, FunctionalLinearReluLinearModel, ConvReluModel, ConvReluConvModel, ConvReluAddModel, FunctionalConvReluModel, FunctionalConvReluConvModel
  import copy
  import numpy
  from hypothesis import given
  from hypothesis import strategies
label_desc: Use image node_id 15 for calling the TestEqualizeFx obj's underlying member method code with example usage: obj.test_input_weight_equalization_graphs() without return types