class_docstr: The ModelReport class aims to provide users an easy way to diagnose issues that they run into
  with their models. The class works with all traceable GraphModules to help diagnose issues,
  though the requirements on the type of model more-so depends on the specific report the user
  is trying to generate. With respect to the reports, the ModelReport class is initialized with
  a set of Detector classes, each of which generate reports on quantization configuration
  issues a use might have.
  
  Currently supports generating reports on:
  - Suggestions for per-channel vs. per-tensor quantization (nn.Module)
  - Suggestions for dynamic vs static quantization for linear layers (Graph Modules)
  - Suggestions for input-weight equalization for linear and conv layers (Graph Modules)
  - Suggestions for outlier detection for all layers (Graph Modules)
  
  The ModelReport class has the primary functionality of inserting observers (primarily the ModelReportObserver)
  where needed for each detector to gather the information it needs, and then after callibration, the ModelReport
  class compiles the report generated by each Detector class into a single report to return to the user. It also
  has the capability to remove all the observers it inserted as well.
  
  * :attr:`_model` The model we wish to generate the report for. Must be a traceable GraphModule
  
  * :attr:`_desired_report_detectors` The set of Detectors representing desired reports from the ModelReport class
      Make sure that these are all unique types of detectors [do not have more than 1 of the same class]
  
  * :attr:`_desired_detector_names` The set of detector names of the _desired_report_detectors.
      This set is generated by calling the get_detector_name() of each detector
  
  * :attr:`_detector_name_to_observer_fqns` The mapping from each detector to fqns of observers of interest
      The purpose of this is to keep track of what observers were inserted for each detector, so that they
      can be removed at the end if desired
  
  * :attr:`_prepared_flag` A boolean flag that keeps track of whether we have prepared the model or not
      This is to ensure we only insert observers once with the ModelReport instance
  
  * :attr:`_removed_observers` A boolean to track if we have removed observers already
      The purpose is to ensure we don't attempt to remove observers twice with the same ModelReport
      instance. This also allows the functionality where we can generate the report multiple times
      as long as we haven't removed the observers yet.
  
  Note:
      This class was initially designed to work with the Fx Graph Mode workflow in mind. However,
      full functionality is available as long as there is a traceable GraphModule that is being used.
      One method to get a traceable GraphModule without going through the Fx workflow is to use
      the QuantizationTracer class.
  
  General Flow for Fx workflow:
  1.) Initialize ModelReport object with reports of interest by passing in initialized detector objects and model
  2.) Prepare your model with prepare_fx
  3.) Call model_report.prepare_detailed_calibration to add relevant observers
  4.) Callibrate your model with data
  5.) Call model_report.generate_report on your model to generate report and optionally remove added observers
  Optional
      6.) Call model_report.generate_visualizer to get a ModelReportVisualizer instance
      7.) To help in parsing report information and debugging, view report info as a:
          - Table
          - Histogram
          - Line plot
  8.) Call model_report.generate_qconfigs to generate the qconfigs based on the report suggestions
  
  Example (with QuantizationTracer):
      >>> # xdoctest: +SKIP
      >>> # get the necessary qconfig
      >>> config = PrepareCustomConfig()
      >>> skipped_module_names, skipped_module_classes = get_skipped_module_name_and_classes(config, False)
  
      >>> # initialize our model and get GraphModule
      >>> model = SomeModel()
      >>> tracer = QuantizationTracer(skipped_module_names, skipped_module_classes)
      >>> graph_module = GraphModule(model, tracer.trace(model))
  
      >>> # get our set of detectors and ModelReport instance
      >>> detector_set = set([DynamicStaticDetector(tolerance=0.5), InputWeightEqualizationDetector(ratio_threshold=0.7)])
      >>> tracer_reporter = ModelReport(graph_module, tracer_detector_set)
  
      >>> # now we insert the observers and callibrate the model
      >>> tracer_model_with_observers = tracer_reporter.prepare_detailed_calibration()
      >>> for i in range(num_callibration_batches):
      >>>     example_input = get_callibration_input()
      >>>     tracer_model_with_observers(example_input)
  
      >>> # finally we generate the reports and optionally remove the observers we inserted
      >>> reports = tracer_reporter.generate_model_report(remove_inserted_observers=True)
  
      >>> # Optional: we can generate the qconfig mapping based on the suggestions
      >>> qconfigs = model_report.generate_qconfig_mapping()
  
      >>> # Optional: we can generate the equalization mapping based on the suggestions
      >>> qconfigs = model_report.generate_equalization_mapping()
  
      >>> # Optional: we get a ModelReportVisualizer instance to do any visualizations desired
      >>> model_report_visualizer = tracer_reporter.generate_visualizer()
class_docstr_tok: ["The","ModelReport","class","aims","to","provide","users","an","easy","way","to","diagnose","issues","that","they","run","into","with","their","models",".","The","class","works","with","all","traceable","GraphModules","to","help","diagnose","issues",",","though","the","requirements","on","the","type","of","model","more-so","depends","on","the","specific","report","the","user","is","trying","to","generate",".","With","respect","to","the","reports",",","the","ModelReport","class","is","initialized","with","a","set","of","Detector","classes",",","each","of","which","generate","reports","on","quantization","configuration","issues","a","use","might","have",".","Currently","supports","generating","reports","on",":","-","Suggestions","for","per-channel","vs.","per-tensor","quantization","(","nn.Module",")","-","Suggestions","for","dynamic","vs","static","quantization","for","linear","layers","(","Graph","Modules",")","-","Suggestions","for","input-weight","equalization","for","linear","and","conv","layers","(","Graph","Modules",")","-","Suggestions","for","outlier","detection","for","all","layers","(","Graph","Modules",")","The","ModelReport","class","has","the","primary","functionality","of","inserting","observers","(","primarily","the","ModelReportObserver",")","where","needed","for","each","detector","to","gather","the","information","it","needs",",","and","then","after","callibration",",","the","ModelReport","class","compiles","the","report","generated","by","each","Detector","class","into","a","single","report","to","return","to","the","user",".","It","also","has","the","capability","to","remove","all","the","observers","it","inserted","as","well",".","*",":","attr",":","`","_model","`","The","model","we","wish","to","generate","the","report","for",".","Must","be","a","traceable","GraphModule","*",":","attr",":","`","_desired_report_detectors","`","The","set","of","Detectors","representing","desired","reports","from","the","ModelReport","class","Make","sure","that","these","are","all","unique","types","of","detectors","[","do","not","have","more","than","1","of","the","same","class","]","*",":","attr",":","`","_desired_detector_names","`","The","set","of","detector","names","of","the","_desired_report_detectors",".","This","set","is","generated","by","calling","the","get_detector_name","(",")","of","each","detector","*",":","attr",":","`","_detector_name_to_observer_fqns","`","The","mapping","from","each","detector","to","fqns","of","observers","of","interest","The","purpose","of","this","is","to","keep","track","of","what","observers","were","inserted","for","each","detector",",","so","that","they","can","be","removed","at","the","end","if","desired","*",":","attr",":","`","_prepared_flag","`","A","boolean","flag","that","keeps","track","of","whether","we","have","prepared","the","model","or","not","This","is","to","ensure","we","only","insert","observers","once","with","the","ModelReport","instance","*",":","attr",":","`","_removed_observers","`","A","boolean","to","track","if","we","have","removed","observers","already","The","purpose","is","to","ensure","we","do","n't","attempt","to","remove","observers","twice","with","the","same","ModelReport","instance",".","This","also","allows","the","functionality","where","we","can","generate","the","report","multiple","times","as","long","as","we","have","n't","removed","the","observers","yet",".","Note",":","This","class","was","initially","designed","to","work","with","the","Fx","Graph","Mode","workflow","in","mind",".","However",",","full","functionality","is","available","as","long","as","there","is","a","traceable","GraphModule","that","is","being","used",".","One","method","to","get","a","traceable","GraphModule","without","going","through","the","Fx","workflow","is","to","use","the","QuantizationTracer","class",".","General","Flow","for","Fx","workflow",":","1",".",")","Initialize","ModelReport","object","with","reports","of","interest","by","passing","in","initialized","detector","objects","and","model","2",".",")","Prepare","your","model","with","prepare_fx","3",".",")","Call","model_report.prepare_detailed_calibration","to","add","relevant","observers","4",".",")","Callibrate","your","model","with","data","5",".",")","Call","model_report.generate_report","on","your","model","to","generate","report","and","optionally","remove","added","observers","Optional","6",".",")","Call","model_report.generate_visualizer","to","get","a","ModelReportVisualizer","instance","7",".",")","To","help","in","parsing","report","information","and","debugging",",","view","report","info","as","a",":","-","Table","-","Histogram","-","Line","plot","8",".",")","Call","model_report.generate_qconfigs","to","generate","the","qconfigs","based","on","the","report","suggestions","Example","(","with","QuantizationTracer",")",":",">",">",">","#","xdoctest",":","+SKIP",">",">",">","#","get","the","necessary","qconfig",">",">",">","config","=","PrepareCustomConfig","(",")",">",">",">","skipped_module_names",",","skipped_module_classes","=","get_skipped_module_name_and_classes","(","config",",","False",")",">",">",">","#","initialize","our","model","and","get","GraphModule",">",">",">","model","=","SomeModel","(",")",">",">",">","tracer","=","QuantizationTracer","(","skipped_module_names",",","skipped_module_classes",")",">",">",">","graph_module","=","GraphModule","(","model",",","tracer.trace","(","model",")",")",">",">",">","#","get","our","set","of","detectors","and","ModelReport","instance",">",">",">","detector_set","=","set","(","[","DynamicStaticDetector","(","tolerance=0.5",")",",","InputWeightEqualizationDetector","(","ratio_threshold=0.7",")","]",")",">",">",">","tracer_reporter","=","ModelReport","(","graph_module",",","tracer_detector_set",")",">",">",">","#","now","we","insert","the","observers","and","callibrate","the","model",">",">",">","tracer_model_with_observers","=","tracer_reporter.prepare_detailed_calibration","(",")",">",">",">","for","i","in","range","(","num_callibration_batches",")",":",">",">",">","example_input","=","get_callibration_input","(",")",">",">",">","tracer_model_with_observers","(","example_input",")",">",">",">","#","finally","we","generate","the","reports","and","optionally","remove","the","observers","we","inserted",">",">",">","reports","=","tracer_reporter.generate_model_report","(","remove_inserted_observers=True",")",">",">",">","#","Optional",":","we","can","generate","the","qconfig","mapping","based","on","the","suggestions",">",">",">","qconfigs","=","model_report.generate_qconfig_mapping","(",")",">",">",">","#","Optional",":","we","can","generate","the","equalization","mapping","based","on","the","suggestions",">",">",">","qconfigs","=","model_report.generate_equalization_mapping","(",")",">",">",">","#","Optional",":","we","get","a","ModelReportVisualizer","instance","to","do","any","visualizations","desired",">",">",">","model_report_visualizer","=","tracer_reporter.generate_visualizer","(",")"]
docstr: Returns a copy of the desired reports for viewing 
docstr_tok: ["Returns","a","copy","of","the","desired","reports","for","viewing"]
code: def get_desired_reports_names(self) -> Set[str]:
      """Returns a copy of the desired reports for viewing"""
      return self._desired_detector_names.copy()
  
imports: from typing import Any, Dict, Set, Tuple, Callable
  from collections import OrderedDict
  import torch
  from torch.ao.quantization.fx._model_report.detector import DetectorBase, DETECTOR_OBS_ARGS_KEY, DETECTOR_OBS_TO_INSERT_KEY, DETECTOR_IS_POST_OBS_KEY, DETECTOR_TARGET_NODE_KEY, DetectorQConfigInfo
  from torch.ao.quantization.fx._model_report.model_report_visualizer import ModelReportVisualizer
  from torch.ao.quantization.fx.graph_module import GraphModule
  from torch.ao.quantization.observer import ObserverBase
  from torch.ao.quantization.qconfig_mapping import QConfigMapping, QConfig
  from torch.ao.quantization.fx._equalize import EqualizationQConfig
label_desc: Use image node_id 2 for calling the ModelReport obj's underlying member method code with example usage: obj.get_desired_reports_names() and returns: self