aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-04-07 16:16:39 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-04-07 17:21:59 -0700
commita402964895cc3234821b59deebc43aeea6f0d4f3 (patch)
treed6bc56c25f826fefc3230e9a219ed983fa1772c8
parent8f45080b4b78812d2cda6ab715508a9cb3772688 (diff)
Re-working resource_loader to address some problems with dynamically loading op libraries.
Change: 119325959
-rw-r--r--tensorflow/python/platform/resource_loader.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/tensorflow/python/platform/resource_loader.py b/tensorflow/python/platform/resource_loader.py
index 26507768f8..2e8de06b91 100644
--- a/tensorflow/python/platform/resource_loader.py
+++ b/tensorflow/python/platform/resource_loader.py
@@ -57,19 +57,25 @@ def get_data_files_path():
Returns:
The directory where files specified in data attribute of py_test
- and py_binary are store.
+ and py_binary are stored.
"""
return os.path.dirname(inspect.getfile(sys._getframe(1)))
-def get_resource_path(subdir, path):
- """Get the path to the specified resource relative to tensorflow/<subdir>/.
+def get_path_to_datafile(path):
+ """Get the path to the specified file in the data dependencies.
+
+ The path is relative to tensorflow/
Args:
- subdir: a string subdirectory relative to tensorflow/
- path: a string resource path relative to tensorflow/<subdir>
+ path: a string resource path relative to tensorflow/
Returns:
- The path to that resource.
+ The path to the specified file present in the data attribute of py_test
+ or py_binary.
+
+ Raises:
+ IOError: If the path is not found, or the resource can't be opened.
"""
- return os.path.join(os.path.abspath(subdir), path)
+ data_files_path = os.path.dirname(inspect.getfile(sys._getframe(1)))
+ return os.path.join(data_files_path, path)