code: def _dequantize_wp(wp, shape, axis=0):
      if len(wp.floatValue) != 0:
          return
  
      is_linear = (
          wp.quantization.WhichOneof("QuantizationType")
          == "linearQuantization"
      )
      if is_linear:
          if len(wp.quantization.linearQuantization.scale) != len(
              wp.quantization.linearQuantization.bias
          ):
              raise Exception(
                  "Linear quantization scale and bias vectors are "
                  "different lengths"
              )
  
      # axis parameter check
      if axis == 1 and len(shape) != 4:
          raise Exception(
              "Dequantization on second axis is only supported "
              "for rank-4 weight blob."
          )
      if axis != 0 and axis != 1:
          raise Exception(
              "Invalid quantization axis {} passed in. Allowed"
              "values are 0 (first axis) and 1 (second axis)".format(
                  axis
              )
          )
  
      nbits = wp.quantization.numberOfBits
      num_weights = _np.prod(shape)
      byte_arr = _np.frombuffer(wp.rawValue, dtype=_np.uint8)
  
      weight_8bit = (
          byte_arr
          if nbits == 8
          else _unpack_to_bytes(byte_arr, num_weights, nbits)
      )
      weight_8bit = weight_8bit.reshape(shape)
  
      if is_linear:
          scale = _np.array(wp.quantization.linearQuantization.scale)
          bias = _np.array(wp.quantization.linearQuantization.bias)
          dequantized_weight = _dequantize_linear(
              weight_8bit, scale, bias, axis
          )
      else:
          lut = _np.array(
              wp.quantization.lookupTableQuantization.floatValue
          )
          dequantized_weight = _dequantize_lut(weight_8bit, lut)
  
      wp.rawValue = bytes()
      wp.quantization.Clear()
      wp.floatValue.extend(dequantized_weight.flatten())
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from sys import stdout
  from os import listdir
  from six import string_types
  from .optimization_utils import _optimize_nn
  from coremltools.models import _SUPPORTED_QUANTIZATION_MODES, _QUANTIZATION_MODE_DEQUANTIZE, _QUANTIZATION_MODE_LOOKUP_TABLE_LINEAR, _QUANTIZATION_MODE_LOOKUP_TABLE_KMEANS, _QUANTIZATION_MODE_CUSTOM_LOOKUP_TABLE, _QUANTIZATION_MODE_LINEAR_QUANTIZATION, _QUANTIZATION_MODE_LINEAR_SYMMETRIC, _LUT_BASED_QUANTIZATION
  from ..utils import _get_nn_layers, _wp_to_fp16wp, _get_model, _macos_version
  from ..._deps import _HAS_SKLEARN
  from ...None import _MINIMUM_QUANTIZED_MODEL_SPEC_VERSION, _MINIMUM_FP16_SPEC_VERSION, _SPECIFICATION_VERSION_IOS_14
label_desc: Use image node_id 12 for calling a global function with example usage: _dequantize_wp(wp, shape, axis) without return types