aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops/control_flow_ops.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/ops/control_flow_ops.py')
-rw-r--r--tensorflow/python/ops/control_flow_ops.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/python/ops/control_flow_ops.py b/tensorflow/python/ops/control_flow_ops.py
index 7be8628073..fb53d9ffea 100644
--- a/tensorflow/python/ops/control_flow_ops.py
+++ b/tensorflow/python/ops/control_flow_ops.py
@@ -833,6 +833,9 @@ class GradLoopState(object):
if outer_grad_state:
outer_forward_ctxt = outer_grad_state.forward_context
else:
+ if not hasattr(forward_ctxt, 'outer_context'):
+ raise ValueError("Failed to call gradients on a while loop without"
+ "properly serializing graph via MetaGraphDef")
outer_forward_ctxt = forward_ctxt.outer_context
# Add the forward loop counter.