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
Loading
Please sign in to comment