class_docstr: This transform works for each ``const`` op if:
  
  - ``_is_deprecated=True`` and the ``op_selector`` returns ``True``.
  - ``_is_deprecated=False`` and the ``const`` value size ``> weight_threshold``.
  
  The transform performs the following:
  
  - Values are linearly quantized into unsigned 8-bits.
  - If ``fake_compression=False``, compressed value is encoded using the ``constexpr_affine_dequantize`` op.
  - If ``fake_compression=True``, compressed value is decompressed and then encoded using the ``const`` op.
class_docstr_tok: ["This","transform","works","for","each","``","const","``","op","if",":","-","``","_is_deprecated=True","``","and","the","``","op_selector","``","returns","``","True","``",".","-","``","_is_deprecated=False","``","and","the","``","const","``","value","size","``",">","weight_threshold","``",".","The","transform","performs","the","following",":","-","Values","are","linearly","quantized","into","unsigned","8-bits",".","-","If","``","fake_compression=False","``",",","compressed","value","is","encoded","using","the","``","constexpr_affine_dequantize","``","op",".","-","If","``","fake_compression=True","``",",","compressed","value","is","decompressed","and","then","encoded","using","the","``","const","``","op","."]
docstr: Get quantized data along with metadata (scale, zero_point).
code: def _get_quantized_data(
      cls,
      original_data: np.ndarray,
      axes: Tuple[int, ...],
      mode: str,
      dtype: type,
  ) -> Tuple[np.ndarray, np.ndarray, Optional[np.ndarray]]:
      """Get quantized data along with metadata (scale, zero_point)."""
      if not np.issubdtype(original_data.dtype, np.floating):
          raise ValueError("Only floating numpy arrays are supported.")
  
      val_min = np.amin(original_data, axis=axes, keepdims=True)
      val_max = np.amax(original_data, axis=axes, keepdims=True)
  
      if mode == "LINEAR_SYMMETRIC":
          # For the linear_symmetric mode, the range is symmetrical to 0
          max_abs = np.maximum(np.abs(val_min), np.abs(val_max))
          val_min = -max_abs
          val_max = max_abs
      else:
          assert mode == "LINEAR"
          # For the linear mode, we need to make sure the data range contains `0`
          val_min = np.minimum(0.0, val_min)
          val_max = np.maximum(0.0, val_max)
  
      q_val_min, q_val_max = cls._MODE_DTYPE_TO_RANGE[(dtype, mode)]
      np_dtype = nptype_from_builtin(dtype)
      zero_point = None
      if mode == "LINEAR_SYMMETRIC":
          if dtype.is_unsigned():
              zero_point_shift = q_val_max // 2
              zero_point = zero_point_shift * np.ones(val_min.shape)
      else:
          assert mode == "LINEAR"
          zero_point = (q_val_min * val_max - q_val_max * val_min) / (
              val_max - val_min
          )
          zero_point = np.round(zero_point)
          zero_point = np.clip(zero_point, q_val_min, q_val_max)
  
      scale = (val_max - val_min) / (q_val_max - q_val_min)
      quantized_data = np.round(original_data / scale)
      if zero_point is not None:
          quantized_data += zero_point
          zero_point = zero_point.squeeze().astype(np_dtype)
      quantized_data = np.clip(
          quantized_data, q_val_min, q_val_max
      ).astype(np_dtype)
      scale = scale.astype(original_data.dtype).squeeze()
  
      return quantized_data, scale, zero_point
  
imports: from typing import Callable, Optional, Tuple
  import numpy
  from tqdm import tqdm
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.backend.mil.load import should_use_weight_file
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Operation, Program, types
  from coremltools.converters.mil.mil.block import is_current_opset_version_compatible_with
  from coremltools.converters.mil.mil.ops.defs._utils import pack_elements_into_bits
  from coremltools.converters.mil.mil.ops.defs.iOS16 import constexpr_affine_dequantize, constexpr_lut_to_dense, constexpr_sparse_to_dense
  from coremltools.converters.mil.mil.passes.defs.quantization import AbstractQuantizationPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  from coremltools.converters.mil.mil.types.type_mapping import nptype_from_builtin
  from coremltools.models.neural_network.quantization_utils import _get_kmeans_lookup_table_and_weight
  from coremltools.optimize.coreml._config import OpLinearQuantizerConfig, OpMagnitudePrunerConfig, OpPalettizerConfig, OpThresholdPrunerConfig, OptimizationConfig
label_desc: Use image node_id 2 for calling the linear_quantize_weights obj's underlying member method code with example usage: obj._get_quantized_data(cls, original_data, axes, mode, dtype) and returns: quantized_data,  scale,  zero_point