代码在jupyter笔记本中得到错误

时间:2017-05-09 16:30:10

标签: python tensorflow

我有一个tensorflow-minist的python代码

代码在命令行中运行良好,但是当我尝试在Jupyter笔记本中运行时,代码获得了InternalError:

jupyte笔记本版本为5.0

jupyter notebook和commandline python版本是python 2.7

---------------------------------------------------------------------------
    InternalError                             Traceback (most recent call last)
    <ipython-input-22-f3470e70570d> in <module>()
         35 for i in range(2001):
         36     batch_xs, batch_ys = choose_batch(x_train,y_train,300,29400)
    ---> 37     sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})
         38     if not(i % 100):
         39         print(i,": Accuracy of the current model: ",sess.run(accuracy, feed_dict={x: x_cv, y_: y_cv}))

/home/zzy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata)
    765     try:
    766       result = self._run(None, fetches, feed_dict, options_ptr,
--> 767                          run_metadata_ptr)
    768       if run_metadata:
    769         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/home/zzy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata)
    963     if final_fetches or final_targets:
    964       results = self._do_run(handle, final_targets, final_fetches,
--> 965                              feed_dict_string, options, run_metadata)
    966     else:
    967       results = []

/home/zzy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1013     if handle is None:
   1014       return self._do_call(_run_fn, self._session, feed_dict, fetch_list,
-> 1015                            target_list, options, run_metadata)
   1016     else:
   1017       return self._do_call(_prun_fn, self._session, handle, feed_dict,

/home/zzy/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_call(self, fn, *args)
   1033         except KeyError:
   1034           pass
-> 1035       raise type(e)(node_def, op, message)
   1036 
   1037   def _extend_graph(self):

InternalError: Blas SGEMM launch failed : a.shape=(300, 784), b.shape=(784, 10), m=300, n=10, k=784
     [[Node: MatMul_1 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_recv_Placeholder_2_0/_5, Variable_2/read)]]

Caused by op u'MatMul_1', defined at:
......
......

0 个答案:

没有答案