docstr: Tests that for small models, the results of quantized models that
  have been equalized are very close to models that have not been equalized.
docstr_tok: ["Tests","that","for","small","models",",","the","results","of","quantized","models","that","have","been","equalized","are","very","close","to","models","that","have","not","been","equalized","."]
code: def test_input_weight_equalization_results(self):
      """Tests that for small models, the results of quantized models that
      have been equalized are very close to models that have not been equalized.
      """
  
      tests = [
          SingleLayerLinearModel,
          TwoLayerLinearModel,
          LinearAddModel,
          SingleLayerFunctionalLinearModel,
          TwoLayerFunctionalLinearModel,
      ]
  
      x = torch.rand((5, 5))
      for M in tests:
          m = M().eval()
  
          # No equalization
          example_inputs = (x,)
          prepared = prepare_fx(
              copy.deepcopy(m),
              specific_qconfig_dict,
              example_inputs=example_inputs,
              _equalization_config={},
          )
          prepared(x)
          quantized = convert_fx(prepared)  # Check if compile
          quantized_output = quantized(x)
  
          # With equalization
          prepared = prepare_fx(
              copy.deepcopy(m),
              specific_qconfig_dict,
              example_inputs=example_inputs,
              _equalization_config=default_equalization_qconfig_dict,
          )
          prepared(x)
          equalized_and_quantized = convert_fx(
              prepared
          )  # Check if compile
          equalized_and_quantized_output = equalized_and_quantized(x)
          self.assertEqual(
              quantized_output,
              equalized_and_quantized_output,
              rtol=1e-5,
              atol=0.1,
          )
  
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 16 for calling the TestEqualizeFx obj's underlying member method code with example usage: obj.test_input_weight_equalization_results() without return types