code: def _linear_dynamic():
      def _calculate_qparam(inp):
          # reference ATen/native/quantized/cpu/qlinear_dynamic.cpp
          # ChooseQuantizationParams function
          mn = _op.min(inp)
          mx = _op.max(inp)
  
          # Ensure that the interval contains 0
          mn = _op.minimum(mn, _op.const(0.0, dtype="float32"))
          mx = _op.maximum(mx, _op.const(0.0, dtype="float32"))
  
          qmax = 255
  
          # reduce_range became True in v1.6
          if is_version_greater_than("1.5.1"):
              qmax = 127
  
          scale = (mx - mn) / _expr.const(qmax, dtype="float32")
  
          zero_point_from_min = -(mn / scale)
          zero_point = _op.cast(
              _op.round(_op.clip(zero_point_from_min, 0.0, qmax)),
              "int32",
          )
  
          return scale, zero_point
  
      def _impl(inputs, _):
          weight = inputs[1][0]
          weight_scale = inputs[1][1]
          weight_zero_point = inputs[1][2]
  
          inp = inputs[0]
  
          input_scale, input_zero_point = _calculate_qparam(inp)
          qinp = relay.qnn.op.quantize(
              inp, input_scale, input_zero_point, out_dtype="uint8"
          )
  
          data_shape = infer_shape(inp)
  
          if len(data_shape) > 2:
              qinp = _op.reverse_reshape(qinp, [-1, 0])
  
          weight_shape = infer_shape(weight)
          units = weight_shape[0]
          dense = relay.qnn.op.dense(
              qinp,
              weight,
              input_zero_point,
              weight_zero_point,
              input_scale,
              weight_scale,
              units=units,
          )
          bias_var = inputs[1][3]
  
          dequant_scale = input_scale * weight_scale
          dense_out = relay.qnn.op.dequantize(
              dense,
              dequant_scale,
              input_zero_point=relay.const(0, "int32"),
              axis=1,
          )
  
          if len(data_shape) > 2:
              new_shape = list(data_shape[:-1])
              new_shape.append(units)
              dense_out = _op.reshape(dense_out, new_shape)
  
          if bias_var is not None:
              return dense_out + bias_var
  
          return dense_out
  
      return _impl
  
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 34 for calling a global function with example usage: _linear_dynamic() and returns: _impl, scale,  zero_point, dense_out, unknown