def _create_constexpr_var(op: Operation, quant_params: "optimize_utils.QuantParams") -> Var:
        """Create constexpr quant op based on opset version."""
        if not is_current_opset_version_compatible_with(AvailableTarget.iOS18):
            quant_params_ios16 = optimize_utils.ios18_quant_params_to_ios16(quant_params)
            return mb.constexpr_affine_dequantize(
                quantized_data=quant_params_ios16.quantized_data,
                zero_point=quant_params_ios16.zero_point,
                scale=quant_params_ios16.scale,
                axis=quant_params_ios16.axis,
                before_op=op,
                name=op.name + "_quantized",
            )

        return mb.constexpr_blockwise_shift_scale(
            data=quant_params.data,
            scale=quant_params.scale,
            offset=quant_params.offset,
            before_op=op,
            name=op.name + "_quantized",
        )
Create constexpr quant op based on opset version.
coremltools/optimize/coreml/_quantization_passes.py