From d78c747e9177fc93d43a580acef2b62eb1420859 Mon Sep 17 00:00:00 2001 From: Nupur Garg Date: Tue, 9 Oct 2018 16:39:33 -0700 Subject: Make lite_test.py run in open source. PiperOrigin-RevId: 216445964 --- tensorflow/contrib/lite/python/BUILD | 2 -- tensorflow/contrib/lite/python/lite_test.py | 14 +++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tensorflow/contrib/lite/python/BUILD b/tensorflow/contrib/lite/python/BUILD index 916788f215..be6c44d306 100644 --- a/tensorflow/contrib/lite/python/BUILD +++ b/tensorflow/contrib/lite/python/BUILD @@ -73,7 +73,6 @@ py_test( data = ["@tflite_mobilenet_ssd_quant_protobuf//:tflite_graph.pb"], srcs_version = "PY2AND3", tags = [ - "no_oss", "no_windows", ], deps = [ @@ -172,7 +171,6 @@ py_test( srcs = ["convert_saved_model_test.py"], srcs_version = "PY2AND3", tags = [ - "no_oss", "no_windows", ], visibility = ["//visibility:public"], diff --git a/tensorflow/contrib/lite/python/lite_test.py b/tensorflow/contrib/lite/python/lite_test.py index d243a494f6..ef9bbded2a 100644 --- a/tensorflow/contrib/lite/python/lite_test.py +++ b/tensorflow/contrib/lite/python/lite_test.py @@ -591,11 +591,19 @@ class FromFrozenGraphFile(test_util.TensorFlowTestCase): 'Unable to parse input file \'{}\'.'.format(graph_def_file), str(error.exception)) - # TODO(nupurgarg): Test model loading in open source. def _initObjectDetectionArgs(self): # Initializes the arguments required for the object detection model. - self._graph_def_file = resource_loader.get_path_to_datafile( - 'testdata/tflite_graph.pb') + # Looks for the model file which is saved in a different location interally + # and externally. + filename = resource_loader.get_path_to_datafile('testdata/tflite_graph.pb') + if not os.path.exists(filename): + filename = os.path.join( + resource_loader.get_root_dir_with_all_resources(), + '../tflite_mobilenet_ssd_quant_protobuf/tflite_graph.pb') + if not os.path.exists(filename): + raise IOError("File '{0}' does not exist.".format(filename)) + + self._graph_def_file = filename self._input_arrays = ['normalized_input_image_tensor'] self._output_arrays = [ 'TFLite_Detection_PostProcess', 'TFLite_Detection_PostProcess:1', -- cgit v1.2.3