aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/python/lite_test.py
diff options
context:
space:
mode:
authorGravatar Nupur Garg <nupurgarg@google.com>2018-10-09 16:39:33 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 16:43:23 -0700
commitd78c747e9177fc93d43a580acef2b62eb1420859 (patch)
tree675b73361d6d4008a60275d30607cecfccfc6510 /tensorflow/contrib/lite/python/lite_test.py
parent6c391166b8b6ba43d2b0151e6fb9cf14864131a2 (diff)
Make lite_test.py run in open source.
PiperOrigin-RevId: 216445964
Diffstat (limited to 'tensorflow/contrib/lite/python/lite_test.py')
-rw-r--r--tensorflow/contrib/lite/python/lite_test.py14
1 files changed, 11 insertions, 3 deletions
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',