Add fully quantize maximum/minimum op tests with a bug fix for maximum and mininum.
PiperOrigin-RevId: 276093641 Change-Id: I7cc4c9a73f093deb1764261a1eb5d5b36ccbc38a
This commit is contained in:
parent
e9597468d8
commit
b7ccdd10ca
@ -22,6 +22,13 @@ package(
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
gen_zipped_test_file(
|
||||
name = "zip_conv_edgetpu",
|
||||
file = "conv_edgetpu.zip",
|
||||
flags = " --make_edgetpu_tests",
|
||||
toco = "//tensorflow/lite/toco:toco", # Unused
|
||||
)
|
||||
|
||||
[gen_zip_test(
|
||||
name = "zip_test_%s" % test_name,
|
||||
size = "medium",
|
||||
@ -478,16 +485,3 @@ tf_py_wrap_cc(
|
||||
)
|
||||
|
||||
tflite_portable_test_suite()
|
||||
|
||||
edgetpu_ops = [
|
||||
"conv",
|
||||
"maximum",
|
||||
"minimum",
|
||||
]
|
||||
|
||||
[gen_zipped_test_file(
|
||||
name = "zip_%s_edgetpu" % op_name,
|
||||
file = "%s_edgetpu.zip" % op_name,
|
||||
flags = " --make_edgetpu_tests",
|
||||
toco = "//tensorflow/lite/toco:toco", # Unused
|
||||
) for op_name in edgetpu_ops]
|
||||
|
@ -31,7 +31,6 @@ def make_maximum_tests(options):
|
||||
"input_dtype": [tf.float32],
|
||||
"input_shape_1": [[], [3], [1, 100], [4, 2, 3], [5, 224, 224, 3]],
|
||||
"input_shape_2": [[], [3], [1, 100], [4, 2, 3], [5, 224, 224, 3]],
|
||||
"fully_quantize": [True, False],
|
||||
}]
|
||||
|
||||
def build_graph(parameters):
|
||||
@ -49,19 +48,11 @@ def make_maximum_tests(options):
|
||||
return [input_tensor_1, input_tensor_2], [out]
|
||||
|
||||
def build_inputs(parameters, sess, inputs, outputs):
|
||||
"""Build inputs for maximum op."""
|
||||
|
||||
values = [
|
||||
create_tensor_data(
|
||||
parameters["input_dtype"],
|
||||
parameters["input_shape_1"],
|
||||
min_value=-1,
|
||||
max_value=1),
|
||||
create_tensor_data(
|
||||
parameters["input_dtype"],
|
||||
parameters["input_shape_2"],
|
||||
min_value=-1,
|
||||
max_value=1)
|
||||
create_tensor_data(parameters["input_dtype"],
|
||||
parameters["input_shape_1"]),
|
||||
create_tensor_data(parameters["input_dtype"],
|
||||
parameters["input_shape_2"])
|
||||
]
|
||||
return values, sess.run(outputs, feed_dict=dict(zip(inputs, values)))
|
||||
|
||||
@ -70,4 +61,4 @@ def make_maximum_tests(options):
|
||||
test_parameters,
|
||||
build_graph,
|
||||
build_inputs,
|
||||
expected_tf_failures=16)
|
||||
expected_tf_failures=8)
|
||||
|
@ -31,7 +31,6 @@ def make_minimum_tests(options):
|
||||
"input_dtype": [tf.float32],
|
||||
"input_shape_1": [[], [3], [1, 100], [4, 2, 3], [5, 224, 224, 3]],
|
||||
"input_shape_2": [[], [3], [1, 100], [4, 2, 3], [5, 224, 224, 3]],
|
||||
"fully_quantize": [True, False],
|
||||
}]
|
||||
|
||||
def build_graph(parameters):
|
||||
@ -49,19 +48,11 @@ def make_minimum_tests(options):
|
||||
return [input_tensor_1, input_tensor_2], [out]
|
||||
|
||||
def build_inputs(parameters, sess, inputs, outputs):
|
||||
"""Build inputs for minimum op."""
|
||||
|
||||
values = [
|
||||
create_tensor_data(
|
||||
parameters["input_dtype"],
|
||||
parameters["input_shape_1"],
|
||||
min_value=-1,
|
||||
max_value=1),
|
||||
create_tensor_data(
|
||||
parameters["input_dtype"],
|
||||
parameters["input_shape_2"],
|
||||
min_value=-1,
|
||||
max_value=1)
|
||||
create_tensor_data(parameters["input_dtype"],
|
||||
parameters["input_shape_1"]),
|
||||
create_tensor_data(parameters["input_dtype"],
|
||||
parameters["input_shape_2"])
|
||||
]
|
||||
return values, sess.run(outputs, feed_dict=dict(zip(inputs, values)))
|
||||
|
||||
@ -70,4 +61,4 @@ def make_minimum_tests(options):
|
||||
test_parameters,
|
||||
build_graph,
|
||||
build_inputs,
|
||||
expected_tf_failures=16)
|
||||
expected_tf_failures=8)
|
||||
|
@ -158,7 +158,7 @@ OperatorProperty GetOperatorProperty(const BuiltinOperator& op) {
|
||||
property.version = 2;
|
||||
break;
|
||||
case BuiltinOperator_MAXIMUM:
|
||||
property.inputs = {{0, {}}, {1, {}}};
|
||||
property.inputs = {{0, {}}};
|
||||
property.outputs = {{0, {}}};
|
||||
property.restrict_same_input_output_scale = true;
|
||||
property.version = 2;
|
||||
@ -169,7 +169,7 @@ OperatorProperty GetOperatorProperty(const BuiltinOperator& op) {
|
||||
property.version = 2;
|
||||
break;
|
||||
case BuiltinOperator_MINIMUM:
|
||||
property.inputs = {{0, {}}, {1, {}}};
|
||||
property.inputs = {{0, {}}};
|
||||
property.outputs = {{0, {}}};
|
||||
property.restrict_same_input_output_scale = true;
|
||||
property.version = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user