aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lookup/lookup_ops.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/lookup/lookup_ops.py')
-rw-r--r--tensorflow/contrib/lookup/lookup_ops.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tensorflow/contrib/lookup/lookup_ops.py b/tensorflow/contrib/lookup/lookup_ops.py
index e49b62afa2..7600d30539 100644
--- a/tensorflow/contrib/lookup/lookup_ops.py
+++ b/tensorflow/contrib/lookup/lookup_ops.py
@@ -21,6 +21,7 @@ from __future__ import print_function
import collections
import functools
+from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
@@ -485,7 +486,10 @@ class TextFileInitializer(TableInitializerBase):
name=scope)
# pylint: enable=protected-access
ops.add_to_collection(ops.GraphKeys.TABLE_INITIALIZERS, init_op)
- ops.add_to_collection(ops.GraphKeys.ASSET_FILEPATHS, filename)
+ # If the filename tensor is anything other than a string constant (e.g., if
+ # it is a placeholder) then it does not make sense to track it as an asset.
+ if constant_op.is_constant(filename):
+ ops.add_to_collection(ops.GraphKeys.ASSET_FILEPATHS, filename)
return init_op