Python error reporting: Copy primary error to bottom of error output.
Fixes https://twitter.com/karpathy/status/765681445637533696 Example new output for a CPU-only binary that executes: ``` import tensorflow as tf s = tf.Session() with tf.device("/gpu:0"): s.run(tf.constant(1.0) + tf.constant(2.0)) ``` is: Traceback (most recent call last): File "baz.py", line 5, in <module> s.run([c]) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 717, in run run_metadata_ptr) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 855, in _run raise RuntimeError('The Session graph is empty. Add operations to the ' RuntimeError: The Session graph is empty. Add operations to the graph before calling run(). (tf)vrv@vijay-linux:~/vrv.tensorflow/tf$ python baz.py Traceback (most recent call last): File "baz.py", line 4, in <module> s.run(tf.constant(1.0) + tf.constant(2.0)) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 717, in run run_metadata_ptr) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 915, in _run feed_dict_string, options, run_metadata) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 965, in _do_run target_list, options, run_metadata) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 985, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors.InvalidArgumentError: Cannot assign a device to node 'add': Could not satisfy explicit device specification '/device:GPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0 [[Node: add = Add[T=DT_FLOAT, _device="/device:GPU:0"](Const, Const_1)]] Caused by op u'add', defined at: File "baz.py", line 4, in <module> s.run(tf.constant(1.0) + tf.constant(2.0)) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 748, in binary_op_wrapper return func(x, y, name=name) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 71, in add result = _op_def_lib.apply_op("Add", x=x, y=y, name=name) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 749, in apply_op op_def=op_def) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2372, in create_op original_op=self._default_original_op, op_def=op_def) File "REDACTED/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1298, in __init__ self._traceback = _extract_stack() InvalidArgumentError (see above for traceback): Cannot assign a device to node 'add': Could not satisfy explicit device specification '/device:GPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0 [[Node: add = Add[T=DT_FLOAT, _device="/device:GPU:0"](Const, Const_1)]] The main error now shows up at the end, which is where people are likely to find it more easily. Change: 133429936
Loading
Please sign in to comment