code: def propagate_dtypes_for_known_nodes(
      graph: Graph,
      node_name_to_match_result_with_qconfig: Dict[
          str, _MatchResultWithQConfig
      ],
  ) -> None:
      """
      Currently we assume that inputs to the graph are either `torch.float` or
      `torch.quint8`, which is not always correct. For ops such as
      `x.masked_fill(mask, value)`, we know that the dtype of  `mask` is a
      `BoolTensor`. Propagate this information throughout the graph.
  
      Note: not all dtypes in the graph will be correct after this pass, but a
      higher percentage of them will be correct. Hopefully in the future we can
      replace this with a better way to reason about dtypes of tensors.
      """
      for node in graph.nodes:
          non_observable_arg_dict = (
              get_non_observable_arg_indexes_and_types(node)
          )
  
          for arg_type in non_observable_arg_dict:
              non_observable_indices = non_observable_arg_dict[
                  arg_type
              ](node)
  
              for index in non_observable_indices:
                  arg = node.args[index]
  
                  # when an argument is a tuple, it does not show up as another node so we need to go through
                  # all elements of the tuple manually
                  if isinstance(arg, (tuple, list)):
                      arg_list = list(arg)
                  else:
                      arg_list = [arg]
  
                  for cur_arg in arg_list:
                      # hard coded arguments show up but aren't `Node` typed and do not need dtype propagated
                      if isinstance(cur_arg, torch.fx.node.Node):
                          _maybe_propagate_dtype_for_node(
                              cur_arg,
                              arg_type,
                              node_name_to_match_result_with_qconfig,
                          )
  
imports: import copy
  import torch
  import warnings
  from torch.fx import GraphModule
  from torch.fx.graph import Graph, Node
  from torch.fx.node import Argument
  from ..quantize import propagate_qconfig_
  from ..observer import _is_activation_post_process, _PartialWrapper
  from ..qconfig import _is_reuse_input_qconfig, QConfigAny
  from ..qconfig_mapping import QConfigMapping
  from .qconfig_mapping_utils import _generate_node_name_to_qconfig, _update_qconfig_for_fusion, _get_flattened_qconfig_dict, _update_qconfig_for_qat
  from .quantize_handler import _default_root_node_getter, _get_pattern_to_quantize_handlers, QuantizeHandler
  from torch.ao.quantization import ObserverBase, FixedQParamsObserver, FixedQParamsFakeQuantize, _DerivedObserverOrFakeQuantize
  from torch.ao.quantization.utils import Pattern, NodePattern
  from ._equalize import is_equalization_observer, node_supports_equalization
  from .pattern_utils import _sorted_patterns_dict
  from .match_utils import _MatchResultWithQConfig, _find_matches
  from .utils import _insert_dequant_stubs_for_custom_module_lstm_output, _is_custom_module_lstm, _maybe_get_custom_module_lstm_from_node_arg, _qconfig_satisfies_dtype_config_constraints, get_custom_module_class_keys, all_node_args_have_no_tensors, assert_and_get_unique_device, get_non_observable_arg_indexes_and_types, get_new_attr_name_with_prefix, node_arg_is_weight, node_arg_is_bias, NON_QUANTIZABLE_WEIGHT_OPS, ObservedGraphModuleAttrs
  from torch.ao.quantization import PlaceholderObserver
  from torch.ao.quantization.quantize import convert
  from ..utils import _parent_name, get_qconfig_dtypes, get_swapped_custom_module_class
  from ..backend_config.utils import get_pattern_to_dtype_configs, get_module_to_qat_module, get_fusion_pattern_to_root_node_getter
  from ..backend_config import BackendConfig, DTypeConfig, get_native_backend_config
  from .custom_config import PrepareCustomConfig, StandaloneModuleConfigEntry
  from torch.ao.quantization.quantizer import EdgeOrNode, QuantizationSpec, QuantizationSpecBase, FixedQParamsQuantizationSpec, SharedQuantizationSpec, DerivedQuantizationSpec
  from torch.ao.quantization import ObserverOrFakeQuantize
  from torch._subclasses import FakeTensor
  from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
  from dataclasses import asdict
label_desc: Use image node_id 26 for calling a global function with example usage: propagate_dtypes_for_known_nodes(graph, node_name_to_match_result_with_qconfig) without return types