aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/framework
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/framework')
-rw-r--r--tensorflow/python/framework/errors_impl.py2
-rw-r--r--tensorflow/python/framework/function.py4
-rw-r--r--tensorflow/python/framework/op_def_library.py4
-rw-r--r--tensorflow/python/framework/op_def_library_test.py3
4 files changed, 9 insertions, 4 deletions
diff --git a/tensorflow/python/framework/errors_impl.py b/tensorflow/python/framework/errors_impl.py
index 04a6e4d7fb..32c96ec947 100644
--- a/tensorflow/python/framework/errors_impl.py
+++ b/tensorflow/python/framework/errors_impl.py
@@ -456,8 +456,8 @@ def _make_specific_exception(node_def, op, message, error_code):
@contextlib.contextmanager
def raise_exception_on_not_ok_status():
+ status = pywrap_tensorflow.TF_NewStatus()
try:
- status = pywrap_tensorflow.TF_NewStatus()
yield status
if pywrap_tensorflow.TF_GetCode(status) != 0:
raise _make_specific_exception(
diff --git a/tensorflow/python/framework/function.py b/tensorflow/python/framework/function.py
index 46da2646ec..7c0201f93e 100644
--- a/tensorflow/python/framework/function.py
+++ b/tensorflow/python/framework/function.py
@@ -769,6 +769,10 @@ class Defun(object):
default graph and adds the definition of the function into the
default graph. Because the addition of the function into the graph
is deferred, the decorator can be used anywhere in the program.
+
+ Definitions of functions are frozen in a graph as soon as the graph is used to
+ create a session. Therefore, nodes using the function must be created in the
+ graph before the corresponding session is created.
Example, but also see the [How To on functions](link_needed).
diff --git a/tensorflow/python/framework/op_def_library.py b/tensorflow/python/framework/op_def_library.py
index cb79954226..7f2b03e350 100644
--- a/tensorflow/python/framework/op_def_library.py
+++ b/tensorflow/python/framework/op_def_library.py
@@ -618,8 +618,8 @@ class OpDefLibrary(object):
if input_arg.is_ref:
if not all(x._is_ref_dtype for x in types): # pylint: disable=protected-access
raise TypeError(
- "Input '%s' of '%s' Op requires l-value input" %
- (input_name, op_type_name))
+ ("'%s' Op requires that input '%s' be a mutable tensor " +
+ "(e.g.: a tf.Variable)") % (op_type_name, input_name))
input_types.extend(types)
else:
input_types.extend(base_types)
diff --git a/tensorflow/python/framework/op_def_library_test.py b/tensorflow/python/framework/op_def_library_test.py
index 0fc7f0b353..715e863b78 100644
--- a/tensorflow/python/framework/op_def_library_test.py
+++ b/tensorflow/python/framework/op_def_library_test.py
@@ -1462,7 +1462,8 @@ class OpDefLibraryTest(test_util.TensorFlowTestCase):
with self.assertRaises(TypeError) as cm:
self._lib.apply_op("RefIn", a=2)
self.assertEqual(str(cm.exception),
- "Input 'a' of 'RefIn' Op requires l-value input")
+ "'RefIn' Op requires that input 'a' be a mutable tensor " +
+ "(e.g.: a tf.Variable)")
input_a = self._lib.apply_op("RefOut", T=dtypes.int32, name="t")
input_b = self._lib.apply_op("RefOut", T=dtypes.int32, name="u")