diff --git a/tensorflow/lite/kernels/reduce.cc b/tensorflow/lite/kernels/reduce.cc index 6107b01cd46..20065883f9d 100644 --- a/tensorflow/lite/kernels/reduce.cc +++ b/tensorflow/lite/kernels/reduce.cc @@ -516,7 +516,8 @@ TfLiteStatus EvalLogic(TfLiteContext* context, TfLiteNode* node, ResizeTempAxis(context, op_context, resolved_axis)); TF_LITE_ENSURE_OK(context, ResizeOutputTensor(context, op_context)); } - if (op_context->input->type == kTfLiteUInt8) { + if (op_context->input->type == kTfLiteUInt8 || + op_context->input->type == kTfLiteInt8) { TF_LITE_ENSURE_EQ(context, op_context->input->params.scale, op_context->output->params.scale); TF_LITE_ENSURE_EQ(context, op_context->input->params.zero_point, diff --git a/tensorflow/lite/testing/op_tests/reduce.py b/tensorflow/lite/testing/op_tests/reduce.py index 259dcad68f3..72324010f4b 100644 --- a/tensorflow/lite/testing/op_tests/reduce.py +++ b/tensorflow/lite/testing/op_tests/reduce.py @@ -249,13 +249,17 @@ def make_reduce_prod_tests(options): @register_make_test_function() def make_reduce_max_tests(options): """Make a set of tests to do max.""" - return make_reduce_tests(tf.reduce_max)(options) + return make_reduce_tests( + tf.reduce_max, allow_fully_quantize=True, min_value=-1, max_value=1)( + options) @register_make_test_function() def make_reduce_min_tests(options): """Make a set of tests to do min.""" - return make_reduce_tests(tf.reduce_min)(options) + return make_reduce_tests( + tf.reduce_min, allow_fully_quantize=True, min_value=-1, max_value=1)( + options) @register_make_test_function() diff --git a/tensorflow/lite/tools/optimize/operator_property.cc b/tensorflow/lite/tools/optimize/operator_property.cc index f2cb98ef31a..e105c0f2d64 100644 --- a/tensorflow/lite/tools/optimize/operator_property.cc +++ b/tensorflow/lite/tools/optimize/operator_property.cc @@ -975,6 +975,13 @@ OperatorProperty GetOperatorProperty(const ModelT* model, int subgraph_index, property.restrict_same_input_output_scale = true; property.version = 2; break; + case BuiltinOperator_REDUCE_MAX: + case BuiltinOperator_REDUCE_MIN: + property.inputs = {{0, {}}}; + property.outputs = {{0, {}}}; + property.restrict_same_input_output_scale = true; + property.version = 2; + break; default: // No quantized implementation exists for this operation. property.quantizable = false;