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: Determines where observers need to be inserted for the Input Weight Equalization Detector.
  For this detector, we want to place observers in front of supported layers.
  
  Currently inserts observers for:
      linear layers
      conv layers
  
  Args:
      prepared_fx_model (GraphModule):  The prepared Fx GraphModule
  
  Returns a Dict mapping from unique observer fqns (where we want to insert them) to a Dict with:
      key "target_node" -> the node we are trying to observe with this observer (torch.fx.node.Node)
      key "observer_to_insert" -> the observer we wish to insert (ObserverBase)
      key "is_post_observer" -> True if this is meant to be a post-observer for target_node, False if pre-observer
      key "observer_args" -> The arguments that are meant to be passed into the observer
docstr_tok: ["Determines","where","observers","need","to","be","inserted","for","the","Input","Weight","Equalization","Detector",".","For","this","detector",",","we","want","to","place","observers","in","front","of","supported","layers",".","Currently","inserts","observers","for",":","linear","layers","conv","layers","Args",":","prepared_fx_model","(","GraphModule",")",":","The","prepared","Fx","GraphModule","Returns","a","Dict","mapping","from","unique","observer","fqns","(","where","we","want","to","insert","them",")","to","a","Dict","with",":","key","``","target_node","''","-",">","the","node","we","are","trying","to","observe","with","this","observer","(","torch.fx.node.Node",")","key","``","observer_to_insert","''","-",">","the","observer","we","wish","to","insert","(","ObserverBase",")","key","``","is_post_observer","''","-",">","True","if","this","is","meant","to","be","a","post-observer","for","target_node",",","False","if","pre-observer","key","``","observer_args","''","-",">","The","arguments","that","are","meant","to","be","passed","into","the","observer"]
code: def determine_observer_insert_points(
      self, prepared_fx_model: GraphModule
  ) -> Dict[str, Dict[str, Any]]:
      r"""Determines where observers need to be inserted for the Input Weight Equalization Detector.
      For this detector, we want to place observers in front of supported layers.
  
      Currently inserts observers for:
          linear layers
          conv layers
  
      Args:
          prepared_fx_model (GraphModule):  The prepared Fx GraphModule
  
      Returns a Dict mapping from unique observer fqns (where we want to insert them) to a Dict with:
          key "target_node" -> the node we are trying to observe with this observer (torch.fx.node.Node)
          key "observer_to_insert" -> the observer we wish to insert (ObserverBase)
          key "is_post_observer" -> True if this is meant to be a post-observer for target_node, False if pre-observer
          key "observer_args" -> The arguments that are meant to be passed into the observer
      """
  
      # observer for this detector is ModelReportObserver
      obs_ctr = ModelReportObserver
  
      # return dict
      obs_fqn_to_info: Dict[str, Dict[str, Any]] = {}
  
      for fqn, module in prepared_fx_model.named_modules():
          # check to see if module is of a supported type
          if self._is_supported(module, insert=True):
              # if it's a supported type, we want to get node and add observer insert locations
              targeted_node = self._get_targeting_node(
                  prepared_fx_model, fqn
              )
  
              # add entry for pre-observer
              pre_obs_fqn = fqn + "." + self.DEFAULT_PRE_OBSERVER_NAME
  
              obs_fqn_to_info[pre_obs_fqn] = {
                  DETECTOR_TARGET_NODE_KEY: targeted_node,
                  DETECTOR_OBS_TO_INSERT_KEY: obs_ctr(
                      ch_axis=self.ch_axis
                  ),
                  DETECTOR_IS_POST_OBS_KEY: False,
                  DETECTOR_OBS_ARGS_KEY: targeted_node.args,
              }
  
      return obs_fqn_to_info
  
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 4 for calling the InputWeightEqualizationDetector obj's underlying member method code with example usage: obj.determine_observer_insert_points(prepared_fx_model) and returns: obs_fqn_to_info