Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 641074571
  • Loading branch information
Google AI Edge authored and copybara-github committed Jun 7, 2024
1 parent c1e1e35 commit c9493ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def check_op_quantization_config(
"""
if op_quant_config.weight_tensor_config.dtype != qtyping.TensorDataType.INT:
raise ValueError(
"Weights need to have integer type for naive min/max quantization."
"Weights need to have integer type for min/max uniform quantization. If"
" you wish to perform float casting quantization (e.g., fp16 weight"
" only), please set algorithm key as 'float_casting'."
)
execution_mode = op_quant_config.execution_mode
if execution_mode == _OpExecutionMode.WEIGHT_ONLY:
Expand Down
2 changes: 2 additions & 0 deletions ai_edge_quantizer/algorithms/utils/min_max_quantize_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def check_srq_config(
)
if act_config is None:
raise ValueError("activation_tensor_config is required for SRQ.")
if act_config.dtype != qtyping.TensorDataType.INT:
raise ValueError("SRQ requires activation tensor to be int type.")
if act_config.num_bits not in (8, 16):
raise ValueError(
f"Only int8/int16 activation SRQ is supported for op {op_name}."
Expand Down

0 comments on commit c9493ea

Please sign in to comment.