问答详情
源自:-

这节课的环境怎么没有说明啊,tf用什么版本的

During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "E:/Documents/Python Scripts/mnist/mnist/regression.py", line 28, in <module>

    print((sess.run(accuracy, feed_dict={x: data.test.images, y_: data.train.labels})))

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py", line 950, in run

    run_metadata_ptr)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run

    feed_dict_tensor, options, run_metadata)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run

    run_metadata)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call

    raise type(e)(node_def, op, message)

tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.

  (0) Invalid argument: Incompatible shapes: [10000] vs. [55000]

[[node Equal (defined at E:/Documents/Python Scripts/mnist/mnist/regression.py:18) ]]

[[Mean/_9]]

  (1) Invalid argument: Incompatible shapes: [10000] vs. [55000]

[[node Equal (defined at E:/Documents/Python Scripts/mnist/mnist/regression.py:18) ]]

0 successful operations.

0 derived errors ignored.


Original stack trace for 'Equal':

  File "E:/Documents/Python Scripts/mnist/mnist/regression.py", line 18, in <module>

    correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 3740, in equal

    "Equal", x=x, y=y, name=name)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper

    op_def=op_def)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func

    return func(*args, **kwargs)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op

    op_def=op_def)

  File "C:\Users\18927\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__

    self._traceback = tf_stack.extract_stack()

:

提问者:Shelton117 2019-09-19 17:43

个回答