caicloud / tensorflow-tutorial

Example TensorFlow codes and Caicloud TensorFlow as a Service dev environment.
2.93k stars 2.08k forks source link

something wrong with the last part of code #8

Closed brucelau126 closed 7 years ago

brucelau126 commented 7 years ago

something wrong with the last part of code: I run the jupyter code, but there is something on my laptop. What's wrong with it? Thanks for your kindly help for a beginner :) 结果显示如下,不知道哪里错了:

w1: [[-0.81131822 1.48459876 0.06532937] [-2.4427042 0.0992484 0.59122431]] w2: [[-0.81131822] [ 1.48459876] [ 0.06532937]]


InternalError Traceback (most recent call last)

in () 13 start = (i*batch_size) % 128 14 end = (i*batch_size) % 128 + batch_size ---> 15 sess.run(train_step, feed_dict={x: X[start:end], y_: Y[start:end]}) 16 if i % 1000 == 0: 17 total_cross_entropy = sess.run(cross_entropy, feed_dict={x: X, y_: Y}) /home/brucelau/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/brucelau/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/brucelau/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/brucelau/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=(8, 2), b.shape=(2, 3), m=8, n=3, k=2 [[Node: MatMul_2 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_recv_x-input_1_0/_11, Variable_2/read)]] Caused by op u'MatMul_2', defined at: File "/home/brucelau/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/home/brucelau/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/__main__.py", line 3, in app.launch_new_instance() File "/home/brucelau/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance app.start() File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 474, in start ioloop.IOLoop.instance().start() File "/home/brucelau/anaconda2/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 177, in start super(ZMQIOLoop, self).start() File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 887, in start handler_func(fd_obj, events) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events self._handle_recv() File "/home/brucelau/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv self._run_callback(callback, msg) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback callback(*args, **kwargs) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 276, in dispatcher return self.dispatch_shell(stream, msg) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 228, in dispatch_shell handler(stream, idents, msg) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 390, in execute_request user_expressions, allow_stdin) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/ipkernel.py", line 196, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/ipykernel/zmqshell.py", line 501, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2717, in run_cell interactivity=interactivity, compiler=compiler, result=result) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2821, in run_ast_nodes if self.run_code(code, result): File "/home/brucelau/anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in a = tf.matmul(x, w1) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 1855, in matmul a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1454, in _mat_mul transpose_b=transpose_b, name=name) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op op_def=op_def) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2395, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/brucelau/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1264, in __init__ self._traceback = _extract_stack() InternalError (see above for traceback): Blas SGEMM launch failed : a.shape=(8, 2), b.shape=(2, 3), m=8, n=3, k=2 [[Node: MatMul_2 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/job:localhost/replica:0/task:0/gpu:0"](_recv_x-input_1_0/_11, Variable_2/read)]]
perhapszzy commented 7 years ago

感觉有可能是tf版本问题

brucelau126 commented 7 years ago

重装了下 已调试成功,非常感谢