Modify op version in optimize only if convertor version < quantized version.

PiperOrigin-RevId: 311216743
Change-Id: Iaac04750d0d302e9bba11b223c2885d6a36d74b3
This commit is contained in:
Sachin Joglekar 2020-05-12 15:41:09 -07:00 committed by TensorFlower Gardener
parent f38355dab3
commit 9a43ab39f2

View File

@ -134,8 +134,10 @@ void SetOperatorCodeVersion(ModelT* model) {
OperatorCodeT* op_code = model->operator_codes[op->opcode_index].get();
operator_property::OperatorProperty property =
operator_property::GetOperatorProperty(model, subgraph_idx, op_idx);
if (property.quantizable) {
// Only update the versions of quantizable operations.
if (property.quantizable && op_code->version < property.version) {
// Only update the versions of quantizable operations if the original
// version is lesser than minimum quantized one mentioned by
// OperatorProperty.
op_code->version = property.version;
}
}