No OpKernel was registered to support Op 'HashTableV2' with these attrs. Registered devices: [CPU,GPU],...
up vote
0
down vote
favorite
I am coding with tensorflow 1.5.0, python 3.5. I want to create a hashtable. Since I intend to assign values to it later, I create it in the init function like this.(the values and shape are randomly given)
enter image description here
but then I encounter a problem like this
enter image description here
Can anyone help me?
python tensorflow hashtable
add a comment |
up vote
0
down vote
favorite
I am coding with tensorflow 1.5.0, python 3.5. I want to create a hashtable. Since I intend to assign values to it later, I create it in the init function like this.(the values and shape are randomly given)
enter image description here
but then I encounter a problem like this
enter image description here
Can anyone help me?
python tensorflow hashtable
1
Please post your code and error messages as text in the question instead of using screenshots.
– jdehesa
Nov 7 at 12:55
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am coding with tensorflow 1.5.0, python 3.5. I want to create a hashtable. Since I intend to assign values to it later, I create it in the init function like this.(the values and shape are randomly given)
enter image description here
but then I encounter a problem like this
enter image description here
Can anyone help me?
python tensorflow hashtable
I am coding with tensorflow 1.5.0, python 3.5. I want to create a hashtable. Since I intend to assign values to it later, I create it in the init function like this.(the values and shape are randomly given)
enter image description here
but then I encounter a problem like this
enter image description here
Can anyone help me?
python tensorflow hashtable
python tensorflow hashtable
edited Nov 7 at 13:29
jdehesa
21k43150
21k43150
asked Nov 7 at 12:21
jieyu
1
1
1
Please post your code and error messages as text in the question instead of using screenshots.
– jdehesa
Nov 7 at 12:55
add a comment |
1
Please post your code and error messages as text in the question instead of using screenshots.
– jdehesa
Nov 7 at 12:55
1
1
Please post your code and error messages as text in the question instead of using screenshots.
– jdehesa
Nov 7 at 12:55
Please post your code and error messages as text in the question instead of using screenshots.
– jdehesa
Nov 7 at 12:55
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
It seems that the implementation of HashTable in your version of TensorFlow does not provide kernels for every possible combination of key and value types. There are two things you can do:
According to your error message, there is a kernel implementation for 64-bit integer keys and 32-bit float values. So one possible fix is to simply change the data type of
keys
totf.int64
:
keys = tf.constant([1, 2, 3]), dtype=tf.int64)
Another possibility is to update TensorFlow to a version where this combination of key and value is implemented. It seems this was added in version v1.11.0-rc0 (see commmit), so upgrading to that or a later version (in general it is more recommendable to upgrade to a stable version instead of a release candidate) should also fix the problem.
add a comment |
up vote
0
down vote
The answers by @jdehesa is really great. It works for me!!! my tf version is 1.4, python=3.6
Here is my code which works:
import tensorflow as tf
from tensorflow.contrib.lookup import *
k = tf.range(1, 3, dtype=tf.int64)
v = tf.range(5, 7, dtype=tf.int64)
table = tf.contrib.lookup.HashTable(
tf.contrib.lookup.KeyValueTensorInitializer(k, v, key_dtype=tf.int64, value_dtype=tf.int64), -1)
out = table.lookup(tf.constant([2,1], dtype=tf.int64))
with tf.Session() as sess:
print(sess.run([k, v]))
table.init.run()
print(out.eval())
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It seems that the implementation of HashTable in your version of TensorFlow does not provide kernels for every possible combination of key and value types. There are two things you can do:
According to your error message, there is a kernel implementation for 64-bit integer keys and 32-bit float values. So one possible fix is to simply change the data type of
keys
totf.int64
:
keys = tf.constant([1, 2, 3]), dtype=tf.int64)
Another possibility is to update TensorFlow to a version where this combination of key and value is implemented. It seems this was added in version v1.11.0-rc0 (see commmit), so upgrading to that or a later version (in general it is more recommendable to upgrade to a stable version instead of a release candidate) should also fix the problem.
add a comment |
up vote
0
down vote
It seems that the implementation of HashTable in your version of TensorFlow does not provide kernels for every possible combination of key and value types. There are two things you can do:
According to your error message, there is a kernel implementation for 64-bit integer keys and 32-bit float values. So one possible fix is to simply change the data type of
keys
totf.int64
:
keys = tf.constant([1, 2, 3]), dtype=tf.int64)
Another possibility is to update TensorFlow to a version where this combination of key and value is implemented. It seems this was added in version v1.11.0-rc0 (see commmit), so upgrading to that or a later version (in general it is more recommendable to upgrade to a stable version instead of a release candidate) should also fix the problem.
add a comment |
up vote
0
down vote
up vote
0
down vote
It seems that the implementation of HashTable in your version of TensorFlow does not provide kernels for every possible combination of key and value types. There are two things you can do:
According to your error message, there is a kernel implementation for 64-bit integer keys and 32-bit float values. So one possible fix is to simply change the data type of
keys
totf.int64
:
keys = tf.constant([1, 2, 3]), dtype=tf.int64)
Another possibility is to update TensorFlow to a version where this combination of key and value is implemented. It seems this was added in version v1.11.0-rc0 (see commmit), so upgrading to that or a later version (in general it is more recommendable to upgrade to a stable version instead of a release candidate) should also fix the problem.
It seems that the implementation of HashTable in your version of TensorFlow does not provide kernels for every possible combination of key and value types. There are two things you can do:
According to your error message, there is a kernel implementation for 64-bit integer keys and 32-bit float values. So one possible fix is to simply change the data type of
keys
totf.int64
:
keys = tf.constant([1, 2, 3]), dtype=tf.int64)
Another possibility is to update TensorFlow to a version where this combination of key and value is implemented. It seems this was added in version v1.11.0-rc0 (see commmit), so upgrading to that or a later version (in general it is more recommendable to upgrade to a stable version instead of a release candidate) should also fix the problem.
answered Nov 7 at 13:04
jdehesa
21k43150
21k43150
add a comment |
add a comment |
up vote
0
down vote
The answers by @jdehesa is really great. It works for me!!! my tf version is 1.4, python=3.6
Here is my code which works:
import tensorflow as tf
from tensorflow.contrib.lookup import *
k = tf.range(1, 3, dtype=tf.int64)
v = tf.range(5, 7, dtype=tf.int64)
table = tf.contrib.lookup.HashTable(
tf.contrib.lookup.KeyValueTensorInitializer(k, v, key_dtype=tf.int64, value_dtype=tf.int64), -1)
out = table.lookup(tf.constant([2,1], dtype=tf.int64))
with tf.Session() as sess:
print(sess.run([k, v]))
table.init.run()
print(out.eval())
add a comment |
up vote
0
down vote
The answers by @jdehesa is really great. It works for me!!! my tf version is 1.4, python=3.6
Here is my code which works:
import tensorflow as tf
from tensorflow.contrib.lookup import *
k = tf.range(1, 3, dtype=tf.int64)
v = tf.range(5, 7, dtype=tf.int64)
table = tf.contrib.lookup.HashTable(
tf.contrib.lookup.KeyValueTensorInitializer(k, v, key_dtype=tf.int64, value_dtype=tf.int64), -1)
out = table.lookup(tf.constant([2,1], dtype=tf.int64))
with tf.Session() as sess:
print(sess.run([k, v]))
table.init.run()
print(out.eval())
add a comment |
up vote
0
down vote
up vote
0
down vote
The answers by @jdehesa is really great. It works for me!!! my tf version is 1.4, python=3.6
Here is my code which works:
import tensorflow as tf
from tensorflow.contrib.lookup import *
k = tf.range(1, 3, dtype=tf.int64)
v = tf.range(5, 7, dtype=tf.int64)
table = tf.contrib.lookup.HashTable(
tf.contrib.lookup.KeyValueTensorInitializer(k, v, key_dtype=tf.int64, value_dtype=tf.int64), -1)
out = table.lookup(tf.constant([2,1], dtype=tf.int64))
with tf.Session() as sess:
print(sess.run([k, v]))
table.init.run()
print(out.eval())
The answers by @jdehesa is really great. It works for me!!! my tf version is 1.4, python=3.6
Here is my code which works:
import tensorflow as tf
from tensorflow.contrib.lookup import *
k = tf.range(1, 3, dtype=tf.int64)
v = tf.range(5, 7, dtype=tf.int64)
table = tf.contrib.lookup.HashTable(
tf.contrib.lookup.KeyValueTensorInitializer(k, v, key_dtype=tf.int64, value_dtype=tf.int64), -1)
out = table.lookup(tf.constant([2,1], dtype=tf.int64))
with tf.Session() as sess:
print(sess.run([k, v]))
table.init.run()
print(out.eval())
answered Nov 10 at 12:41
huosan0123
114
114
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53189379%2fno-opkernel-was-registered-to-support-op-hashtablev2-with-these-attrs-registe%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please post your code and error messages as text in the question instead of using screenshots.
– jdehesa
Nov 7 at 12:55