class_docstr: Base class for capturing intermediate values.
class_docstr_tok: ["Base","class","for","capturing","intermediate","values","."]
code: def __init__(
      self,
      ref_node_name: str,
      prev_node_name: str,
      model_name: str,
      ref_name: str,
      prev_node_target_type: str,
      ref_node_target_type: str,
      results_type: str,
      index_within_arg: int,
      index_of_arg: int,
      fqn: Optional[str],
      qconfig_str: Optional[str] = "",
  ):
      super().__init__()
      self.stats: List[torch.Tensor] = []
      self.stats_rnn: List[RNNReturnType] = []
  
      # name of the node which was responsible for adding this logger
      # Note:
      # - if we are logging node outputs, this is the same as prev_node_name
      # - if we are logging node inputs, this is the name of the node
      #   whose input this logger is logging.
      #
      # example, where logger1 is logging input of op1 and logger2 is logging
      #    the output of op1:
      #
      #  x1 -> logger1 -> op1 -> logger2 -> x2
      #
      # in this example,
      #   - logger1's prev_node_name is x1 and ref_node_name is op1
      #   - logger2's prev_node_name is op1 and ref_node_name is op1
      self.ref_node_name = ref_node_name
      # name of the node whose output this Logger is capturing
      self.prev_node_name = prev_node_name
  
      # name of the model from which the node originated from
      self.model_name = model_name
      # reference name, used to match loggers from separate models
      # to each other
      self.ref_name = ref_name
      # type of the target of the node whose output this logger is logging
      self.prev_node_target_type = prev_node_target_type
      # type of the target of the node which was responsible for adding this
      # logger
      self.ref_node_target_type = ref_node_target_type
      # what kind of values are inside of stats
      self.results_type = results_type
      # index of this node within the arg of the input/output node
      # for example, in cat([x1, x2, x3], dim=0), x2 would have index_within_arg == 1
      self.index_within_arg = index_within_arg
      # index of this node within the args of the input/output node
      # for example, in add(x1, x2), x2 would have index_of_arg == 1
      self.index_of_arg = index_of_arg
      # fully qualified name
      self.fqn = fqn
      # if loggers are added before prepare_fx, but we do not want
      # collect results of calibration, only results after convert_fx
      # so, we add a flag to control whether this logger collects data
      self.enabled = True
      # string representation of qconfig
      self.qconfig_str = qconfig_str
      # this can be turned off to reduce memory usage during calibration
      self.save_activations = True
  
imports: import collections
  import torch
  import torch.nn
  import torch.ao.quantization.quantize_fx
  from torch.fx import GraphModule
  from torch.fx.graph import Node
  from torch.ao.ns.fx.mappings import get_base_name_to_sets_of_related_ops
  from torch.ao.ns.fx.graph_matcher import get_matching_subgraph_pairs, get_type_a_related_to_b
  from .fx.weight_utils import extract_weight_from_node
  from .fx.graph_passes import add_loggers_to_model, create_a_shadows_b
  from .fx.utils import rekey_logger_info_on_node_name_of_model, maybe_add_missing_fqns, get_target_type_str
  from .fx.ns_types import NSSingleResultValuesType, NSResultsType, NSNodeTargetType
  from torch.ao.quantization.backend_config.utils import get_fusion_pattern_to_root_node_getter
  from torch.ao.quantization.backend_config import BackendConfig
  from torch.ao.quantization.fx.match_utils import _find_matches
  from torch.ao.quantization.fx.graph_module import _get_observed_graph_module_attr
  from torch.ao.quantization.fx.qconfig_mapping_utils import _generate_node_name_to_qconfig
  from torch.ao.quantization.fx.quantize_handler import _get_pattern_to_quantize_handlers
  from torch.ao.quantization.qconfig import QConfigAny
  from torch.ao.quantization import QConfigMapping
  from torch.ao.ns.fx.n_shadows_utils import OutputProp, _get_dedup_subgraphs, SHADOW_WRAPPER_NODE_NAME_PREFIX, group_results_by_subgraph, create_results_comparison, print_n_shadows_summary, create_n_transformed_and_logged_copies_of_subgraph, create_add_loggers_graph, extract_weight_comparison
  from torch.ao.ns.fx.qconfig_multi_mapping import QConfigMultiMapping
  from typing import Dict, Tuple, Callable, List, Optional, Set, Any, Type
label_desc: Use image node_id 1 to create a new OutputLogger object from inherited base classes: nn with example: obj = OutputLogger(ref_node_name, prev_node_name, model_name, ref_name, prev_node_target_type, ref_node_target_type, results_type, index_within_arg, index_of_arg, fqn, qconfig_str)