def affine_quantize_weights(mlmodel, mode="linear_symmetric", op_selector=None, dtype=_np.int8):
    """
    ``coremltools.compression_utils.affine_quantize_weights`` is deprecated and will be removed in the future.
    Please use :py:class:`coremltools.optimize.coreml.linear_quantize_weights`.
    """
    if op_selector is None:
        op_selector = _default_op_selector

    op_config = _OpLinearQuantizerConfig(mode=mode, dtype=dtype, weight_threshold=None)
    config = _OptimizationConfig(global_config=op_config, is_deprecated=True, op_selector=op_selector)
    return _linear_quantize_weights(mlmodel, config)

    ``coremltools.compression_utils.affine_quantize_weights`` is deprecated and will be removed in the future.
    Please use :py:class:`coremltools.optimize.coreml.linear_quantize_weights`.
    
coremltools/models/ml_program/compression_utils.py