code: def _get_arg_as_input_act_obs_or_fq(
      arg: Node,
      node: Node,
      named_modules: Dict[str, torch.nn.Module],
      obs_or_fq_map: Dict[EdgeOrNode, ObserverOrFakeQuantize],
      is_qat: bool,
  ) -> Optional[ObserverOrFakeQuantize]:
      """Get the observer or fake quant constructor for the Argument `arg`, as input
      to Node `node`
      """
      assert isinstance(arg, Node)
      # "input_qspec_map" is the more general design we'll use for pt2e path
      # it is a map from input argument node to observer or fake quant constructor, for example
      # for the following graph:
      # x -> conv -> output
      #
      # we may annotate conv node like the following:
      # conv.meta[...] = QuantizationAnnotation("input_qspec_map": {x: MinMaxObserver.with_args(dtype=torch.qint8)}, ...)
      #
      if "quantization_annotation" in node.meta:
          input_qspec_map = node.meta[
              "quantization_annotation"
          ].input_qspec_map
          input_arg_qspec = _get_qspec_for_arg(
              arg, input_qspec_map, named_modules
          )
          if input_arg_qspec is None:
              input_arg_obs_or_fq = _DEFAULT_FP32_OBS_OR_FQ_CTR()
          else:
              input_arg_obs_or_fq = _create_obs_or_fq_from_qspec(
                  input_arg_qspec, obs_or_fq_map, is_qat
              )
          return input_arg_obs_or_fq
  
      # we can remove the following path in the future if fx graph mode quantization is
      # no longer used
      is_weight = node_arg_is_weight(node, arg)
      is_bias = node_arg_is_bias(node, arg)
      is_activation = not is_weight and not is_bias
      obs_or_fq_ctr = None
      if is_activation:
          obs_or_fq_ctr = node.meta["target_dtype_info"].get(
              "input_act_obs_or_fq_ctr", _DEFAULT_FP32_OBS_OR_FQ_CTR
          )
      elif is_weight:
          if node.target not in NON_QUANTIZABLE_WEIGHT_OPS:
              obs_or_fq_ctr = node.meta["target_dtype_info"].get(
                  "weight_obs_or_fq_ctr", _DEFAULT_FP32_OBS_OR_FQ_CTR
              )
      else:
          obs_or_fq_ctr = node.meta["target_dtype_info"].get(
              "bias_obs_or_fq_ctr", _DEFAULT_FP32_OBS_OR_FQ_CTR
          )
      return obs_or_fq_ctr() if obs_or_fq_ctr else None
  
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 19 for calling a global function with example usage: _get_arg_as_input_act_obs_or_fq(arg, node, named_modules, obs_or_fq_map, is_qat) and returns: unknown, input_arg_obs_or_fq