Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'Gemm' with these attrs. Registered devices: [CPU], Registered kernels: device='GPU'; T in [DT_FLOAT] #12

Open
iamweiweishi opened this issue Jan 30, 2019 · 0 comments

Comments

@iamweiweishi
Copy link

iamweiweishi commented Jan 30, 2019

I followed your instructions and the 'make' is correctly done.
But when I run 'python test_gemm_op.py', I got the errors,

`/usr/local/lib/python3.6/dist-packages/numpy/lib/type_check.py:546: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead
'a.item() instead', DeprecationWarning, stacklevel=1)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/tensor_util.py:499: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
return np.fromstring(tensor.tensor_content, dtype=dtype).reshape(shape)
Result for xnor_gemm()

E.

ERROR: testGemm (main.GemmTest)

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1139, in _do_call
return fn(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1117, in _run_fn
self._extend_graph()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1166, in _extend_graph
self._session, graph_def.SerializeToString(), status)
File "/usr/lib/python3.6/contextlib.py", line 88, in exit
next(self.gen)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'Gemm' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_FLOAT]

     [[Node: Gemm = Gemm[T=DT_FLOAT, _device="/device:CPU:0"](Sign, Sign_1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test_gemm_op.py", line 19, in testGemm
print(xnor_result.eval())
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 606, in eval
return _eval_using_default_session(self, feed_dict, self.graph, session)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3928, in _eval_using_default_session
return session.run(tensors, feed_dict)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 789, in run
run_metadata_ptr)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1152, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'Gemm' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_FLOAT]

     [[Node: Gemm = Gemm[T=DT_FLOAT, _device="/device:CPU:0"](Sign, Sign_1)]]

Caused by op 'Gemm', defined at:
File "test_gemm_op.py", line 26, in
tf.test.main()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/test.py", line 70, in main
return _googletest.main(argv)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/googletest.py", line 99, in main
benchmark.benchmarks_main(true_main=main_wrapper)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/benchmark.py", line 340, in benchmarks_main
true_main()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/googletest.py", line 98, in main_wrapper
return app.run(main=g_main, argv=args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/googletest.py", line 69, in g_main
return unittest_main(argv=argv)
File "/usr/lib/python3.6/unittest/main.py", line 95, in init
self.runTests()
File "/usr/lib/python3.6/unittest/main.py", line 256, in runTests
self.result = testRunner.run(self.test)
File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in call
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in call
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/case.py", line 653, in call
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "test_gemm_op.py", line 15, in testGemm
xnor_result = xnor_gemm(a, b)
File "", line 30, in gemm
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1269, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'Gemm' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_FLOAT]

     [[Node: Gemm = Gemm[T=DT_FLOAT, _device="/device:CPU:0"](Sign, Sign_1)]]

Ran 2 tests in 0.177s

FAILED (errors=1)

Could you pls give me some tips on this?
Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant