code: def _get_quant_param_for_input(input_value):
      """
      We want to know the input scale and zp of this input_value, since
      input quant params are not explicitly passed around in torch (they
      are embedded in a QTensor data structure, not visible statically).
      We know that it is quantized using output scale and zp
      of some previous quantized op. The purpose of this function
      is to find that pair of parameters.
      """
      # Indices for output scale and zp
      # For example, in quantized::conv2d(%input, %1, %2, %3, %4, %5, %6, %7),
      # 6th and 7th arg are output scale and zp respectively.
  
      # PyTorch 1.6 changed qconv API
      if is_version_greater_than("1.5.1"):
          qconv_indices = (2, 3)
      else:
          qconv_indices = (6, 7)
  
      output_quant_param_indices = {
          "aten::quantize_per_tensor": (1, 2),
          "quantized::conv2d": qconv_indices,
          "quantized::conv2d_relu": qconv_indices,
          "quantized::linear": (2, 3),
          "quantized::linear_relu": (2, 3),
          "quantized::add_relu": (2, 3),
          "quantized::add": (2, 3),
          "quantized::mul_relu": (2, 3),
          "quantized::mul": (2, 3),
          "quantized::cat": (2, 3),
          "quantized::mul_scalar": (2, 3),
          "quantized::add_scalar": (2, 3),
          "quantized::hardswish": (1, 2),
          "quantized::conv_transpose2d": qconv_indices,
          "quantized::leaky_relu": (3, 4),
          "aten::sigmoid": (1, 2),
      }
  
      def dfs(current_node):
          # trace back to find the producer of this input value
          current_op = current_node.kind()
          if current_op in output_quant_param_indices:
              indices = output_quant_param_indices[current_op]
              scale = current_node.inputsAt(indices[0])
              zp = current_node.inputsAt(indices[1])
              return scale, zp
  
          # Trace back eariler nodes, dfs order
          # Assume quantized tensor comes earlier in the args
          for arg in current_node.inputs():
              return dfs(arg.node())
  
          # If input_value is not quantized, we reach here.
          return None, None
  
      return dfs(input_value.node())
  
imports: import numpy
  import tvm
  from tvm import relay
  from tvm.relay import expr
  from tvm.relay import op
  from tvm.relay.frontend.common import infer_shape
  from .common import logger
  from .pytorch_utils import is_version_greater_than
label_desc: Use image node_id 7 for calling a global function with example usage: _get_quant_param_for_input(input_value) and returns: dfs, None,  None, scale,  zp, dfs