class_docstr: Determines whether input-weight equalization can help improve quantization for certain modules.
  
  Specifically, this list of modules includes:
      linear
      conv
  
  Determines whether input-weight equalization is recommended based on the comp stat:
      s_c = sqrt(w_c/W)/sqrt(i_c/I)
      where:
          w_c is range of weight for channel c, W is range of weight over all channels
          i_c is range of input for channel c, I is range of input over all channels
  
      if s_c >= threshold or <= 1 / threshold, recommends input-weight equalization
  
  Args:
      ratio_threshold (float): The threshold for s_c to determine if input-weight equalization is suggested
          Should be between 0 and 1 (both non-inclusive)
      ch_axis (int, optional): The channel axis being observed to determine input weight equalization
          Default: 1
  
  * :attr:`ratio_threshold`: The threshold for s_c to determine if input-weight equalization is suggested
      Should be between 0 and 1
  
  * :attr:`ch_axis`: The channel axis being observed to determine input weight equalization
  
  * :attr:`SUPPORTED_MODULES`: This specifies the modules that are supported for input-weight equalization
  
  * :attr:`DEFAULT_PRE_OBSERVER_NAME`: The name of the pre-observer to be inserted for this detector
class_docstr_tok: ["Determines","whether","input-weight","equalization","can","help","improve","quantization","for","certain","modules",".","Specifically",",","this","list","of","modules","includes",":","linear","conv","Determines","whether","input-weight","equalization","is","recommended","based","on","the","comp","stat",":","s_c","=","sqrt","(","w_c\/W",")","\/sqrt","(","i_c\/I",")","where",":","w_c","is","range","of","weight","for","channel","c",",","W","is","range","of","weight","over","all","channels","i_c","is","range","of","input","for","channel","c",",","I","is","range","of","input","over","all","channels","if","s_c",">","=","threshold","or","<","=","1","\/","threshold",",","recommends","input-weight","equalization","Args",":","ratio_threshold","(","float",")",":","The","threshold","for","s_c","to","determine","if","input-weight","equalization","is","suggested","Should","be","between","0","and","1","(","both","non-inclusive",")","ch_axis","(","int",",","optional",")",":","The","channel","axis","being","observed","to","determine","input","weight","equalization","Default",":","1","*",":","attr",":","`","ratio_threshold","`",":","The","threshold","for","s_c","to","determine","if","input-weight","equalization","is","suggested","Should","be","between","0","and","1","*",":","attr",":","`","ch_axis","`",":","The","channel","axis","being","observed","to","determine","input","weight","equalization","*",":","attr",":","`","SUPPORTED_MODULES","`",":","This","specifies","the","modules","that","are","supported","for","input-weight","equalization","*",":","attr",":","`","DEFAULT_PRE_OBSERVER_NAME","`",":","The","name","of","the","pre-observer","to","be","inserted","for","this","detector"]
docstr: Takes in the information on the min and max values of the inputs and weights and:
      Calculates the comp stat for each channel: s_c = sqrt(w_c/W)/sqrt(i_c/I)
  
  Args:
      input_info (dict): A dict mapping each observer to input range information
      weight_info (dict): A dict mapping each observer to weight range information
  
  Returns a dict mapping relevant observer fqns (str) to a 1-D tensor.
      Each value is a different s_c value for a different channel
docstr_tok: ["Takes","in","the","information","on","the","min","and","max","values","of","the","inputs","and","weights","and",":","Calculates","the","comp","stat","for","each","channel",":","s_c","=","sqrt","(","w_c\/W",")","\/sqrt","(","i_c\/I",")","Args",":","input_info","(","dict",")",":","A","dict","mapping","each","observer","to","input","range","information","weight_info","(","dict",")",":","A","dict","mapping","each","observer","to","weight","range","information","Returns","a","dict","mapping","relevant","observer","fqns","(","str",")","to","a","1-D","tensor",".","Each","value","is","a","different","s_c","value","for","a","different","channel"]
code: def _generate_comparison_values(
      self, input_info: Dict, weight_info: Dict
  ) -> Dict[str, torch.Tensor]:
      r"""
      Takes in the information on the min and max values of the inputs and weights and:
          Calculates the comp stat for each channel: s_c = sqrt(w_c/W)/sqrt(i_c/I)
  
      Args:
          input_info (dict): A dict mapping each observer to input range information
          weight_info (dict): A dict mapping each observer to weight range information
  
      Returns a dict mapping relevant observer fqns (str) to a 1-D tensor.
          Each value is a different s_c value for a different channel
      """
      # create return dictionary for each observer
      module_fqn_to_channel: Dict[str, torch.Tensor] = {}
  
      # for each module (both passed in dicts should have same keys)
      for module_fqn in input_info:
          # raise error if not in weight info
          if module_fqn not in weight_info:
              raise KeyError(
                  f"Unable to find weight range stats for module {module_fqn}"
              )
  
          # calculate the ratios of the weight info and input info
          weight_ratio = self._calculate_range_ratio(
              weight_info[module_fqn], self.WEIGHT_STR, module_fqn
          )
          input_ratio = self._calculate_range_ratio(
              input_info[module_fqn], self.INPUT_STR, module_fqn
          )
  
          # if mismatched size, because of grouping, we want to replicate weight enough times
          weight_channels = len(weight_ratio)
          input_channels = len(input_ratio)
          if weight_channels != input_channels:
              # we try to replicate
              assert (
                  input_channels % weight_channels == 0
              ), "input channels should be divisible by weight channels."
              # get replication factor
              rep_factor: int = input_channels // weight_channels
  
              # weight ratio is (n,), input ratio is (k,), we just repeat weight ratio k // n
              weight_ratio = weight_ratio.repeat(rep_factor)
  
          # calculate the s metric per channel
          s = torch.sqrt(weight_ratio) / torch.sqrt(input_ratio)
          module_fqn_to_channel[module_fqn] = s
  
      # return compiled observer ratios
      return module_fqn_to_channel
  
imports: from typing import Any, Dict, Set, Tuple, Callable, List
  import torch
  import torch.nn
  import torch.ao.nn.qat
  from abc import ABC, abstractmethod
  from torch.ao.quantization.fake_quantize import FakeQuantize
  from torch.ao.quantization.fx.graph_module import GraphModule
  from torch.ao.quantization.fx._model_report.model_report_observer import ModelReportObserver
  from torch.ao.quantization.qconfig import QConfig, default_qconfig, _assert_valid_qconfig
  from torch.ao.quantization.observer import ObserverBase, default_dynamic_quant_observer, default_per_channel_weight_observer, default_observer, default_weight_observer
  from torch.ao.quantization.fx._equalize import default_equalization_qconfig, EqualizationQConfig
  from torch.ao.quantization.observer import _is_activation_post_process
label_desc: Use image node_id 9 for calling the InputWeightEqualizationDetector obj's underlying member method code with example usage: obj._generate_comparison_values(input_info, weight_info) and returns: module_fqn_to_channel