Fix the l2norm zip tests and re-enable all the fully_quantize tests through the new converter

PiperOrigin-RevId: 314469215
Change-Id: I6dfde69466270ec9ea6bdbef07c5aba45651cfd6
This commit is contained in:
Feng Liu 2020-06-02 22:18:46 -07:00 committed by TensorFlower Gardener
parent 3379fb99c8
commit ab7c94927a
2 changed files with 9 additions and 11 deletions

View File

@ -35,9 +35,14 @@ def make_l2norm_tests(options):
"epsilon": [None, 1e-12, 1e-3], "epsilon": [None, 1e-12, 1e-3],
"fully_quantize": [False], "fully_quantize": [False],
}, { }, {
"input_shape": [[5, 7], [1, 1, 1, 1], [1, 3, 4, 3], [3, 15, 14, 3]], "input_shape": [[1, 1, 1, 1], [1, 3, 4, 3], [3, 15, 14, 3]],
"dim": [0, 1, 2, 3, [2, 3], -2], "dim": [3],
"epsilon": [None, 1e-12, 1e-3], "epsilon": [None, 1e-12],
"fully_quantize": [True],
}, { # use another group of test so the dim is set to fuse to tfl.l2norm
"input_shape": [[5, 7]],
"dim": [1],
"epsilon": [None, 1e-12],
"fully_quantize": [True], "fully_quantize": [True],
}] }]
@ -62,4 +67,4 @@ def make_l2norm_tests(options):
test_parameters, test_parameters,
build_graph, build_graph,
build_inputs, build_inputs,
expected_tf_failures=18) expected_tf_failures=9)

View File

@ -115,13 +115,6 @@ def toco_convert(options, graph_def, input_tensors, output_tensors, **kwargs):
converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph( converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph(
graphdef_file.name, input_arrays, output_tensors, input_shapes) graphdef_file.name, input_arrays, output_tensors, input_shapes)
# TODO(b/145313371): Evaluate should we make it work with the new
# converter.
# Note: Currently this line is a non-functional change because the new
# converter is disabled by default. Since this code path doesn't work
# with new converter yet, it's explicitly disabled for easier testing.
converter.experimental_new_converter = False
def representative_dataset(input_tensors): def representative_dataset(input_tensors):
calibration_inputs = [] calibration_inputs = []
for _, shape, _ in input_tensors: for _, shape, _ in input_tensors: