add param check for bit_num

This commit is contained in:
albert-yan 2022-02-24 16:27:17 +08:00
parent 99fbcec2ce
commit c2078b9177
1 changed files with 2 additions and 2 deletions

View File

@ -70,8 +70,8 @@ int QuantParamParser::ParseBitNum(const CommonQuantString &common_quant_string,
return RET_INPUT_PARAM_INVALID;
}
} else if (common_quant->quant_type == schema::QuantType_QUANT_ALL) {
if (common_quant->bit_num <= 0 || common_quant->bit_num > kQuantBitNumInt8) {
MS_LOG(ERROR) << "INPUT ILLEGAL: bit_num should be [1,8].";
if (common_quant->bit_num != kQuantBitNumInt8) {
MS_LOG(ERROR) << "INPUT ILLEGAL: bit_num should be 8.";
return RET_INPUT_PARAM_INVALID;
}
} else if (common_quant->quant_type == schema::QuantType_QUANT_DYNAMIC) {