Commit 0fb8e5f9 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TensorFlower Gardener
Browse files

This change makes errors more informative in case of functions. We now report...

This change makes errors more informative in case of functions. We now report two additional things:
1. The line number/file name of the culprit node inside the function.
2. The function calling stack

For eg, consider the following code:

import tensorflow as tf
tf.enable_eager_execution()

@tf.contrib.eager.defun
def fn3(x):
  return x + 2

@tf.contrib.eager.defun
def fn2(x):
  tf.assert_equal(fn3(x), 3)
  return 2

@tf.contrib.eager.defun
def fn(x):
  return fn2(x)

@tf.contrib.eager.defun
def main(argv):
  x = fn(2)
  print(x)

if __name__ == '__main__':
  tf.app.run()

In this, the error message would contain the following:
InvalidArgumentError: assertion failed: [] [Condition x == y did not hold element-wise:] [x (PartitionedCall:0) = ] [4] [y (assert_equal/y:0) = ] [3]
	 [[node assert_equal/Assert/Assert (defined at filename:line_num) ]]
	 [[StatefulPartitionedCall]]
	 [[StatefulPartitionedCall]] [Op:StatefulPartitionedCall]

Function calling stack:
main -> fn -> fn2

PiperOrigin-RevId: 228593653
parent d9b97ebf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment