没有注册 OpKernel 来支持具有这些属性的 Op 'Conv2D'
No OpKernel was registered to support Op 'Conv2D' with these attrs
新手可能有点蠢,但无法将 conv2d 转换为 运行
windows10
蟒蛇 4.2.13
python 3.5.2
C:\windows\system32>nvcc --version
nvcc:NVIDIA (R) Cuda 编译器驱动程序
版权所有 (c) 2005-2016 NVIDIA 公司
基于 Sat_Sep__3_19:05:48_CDT_2016
Cuda 编译工具,版本 8.0,V8.0.44
cudnn 5.1
张量流 0.12
import numpy as np
import tensorflow as tf
graph1 = tf.Graph()
with graph1.as_default():
f=tf.constant( np.ones(10).reshape(1,1,-1,1) )
g=tf.constant( np.ones(3).reshape(1,-1,1,1) )
conv1=tf.nn.conv2d( f,g, strides=[1,1,1,1] , padding="SAME",name="conv1")
with tf.Session(graph=graph1) as sess:
sess.run(tf.global_variables_initializer())
print(sess.run(f))
print(sess.run(g))
print(sess.run(conv1))
sess.close()
结果:
InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'Conv2D' with these attrs. Registered devices: [CPU,GPU], Registered kernels:
device='CPU'; T in [DT_HALF]
device='CPU'; T in [DT_FLOAT]
device='GPU'; T in [DT_HALF]
device='GPU'; T in [DT_FLOAT]
[[Node: conv = Conv2D[T=DT_DOUBLE, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](Const, Const_1)]]
您应该将两行更改为
f=tf.constant( np.ones(10).reshape(1,1,-1,1).astype(np.float32) )
g=tf.constant( np.ones(3).reshape(1,-1,1,1).astype(np.float32) )
否则这些节点采用 float64
的默认 numpy 类型,它没有 Conv2D
内核
新手可能有点蠢,但无法将 conv2d 转换为 运行
windows10
蟒蛇 4.2.13
python 3.5.2
C:\windows\system32>nvcc --version nvcc:NVIDIA (R) Cuda 编译器驱动程序 版权所有 (c) 2005-2016 NVIDIA 公司 基于 Sat_Sep__3_19:05:48_CDT_2016 Cuda 编译工具,版本 8.0,V8.0.44
cudnn 5.1
张量流 0.12
import numpy as np
import tensorflow as tf
graph1 = tf.Graph()
with graph1.as_default():
f=tf.constant( np.ones(10).reshape(1,1,-1,1) )
g=tf.constant( np.ones(3).reshape(1,-1,1,1) )
conv1=tf.nn.conv2d( f,g, strides=[1,1,1,1] , padding="SAME",name="conv1")
with tf.Session(graph=graph1) as sess:
sess.run(tf.global_variables_initializer())
print(sess.run(f))
print(sess.run(g))
print(sess.run(conv1))
sess.close()
结果:
InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'Conv2D' with these attrs. Registered devices: [CPU,GPU], Registered kernels:
device='CPU'; T in [DT_HALF]
device='CPU'; T in [DT_FLOAT]
device='GPU'; T in [DT_HALF]
device='GPU'; T in [DT_FLOAT]
[[Node: conv = Conv2D[T=DT_DOUBLE, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](Const, Const_1)]]
您应该将两行更改为
f=tf.constant( np.ones(10).reshape(1,1,-1,1).astype(np.float32) )
g=tf.constant( np.ones(3).reshape(1,-1,1,1).astype(np.float32) )
否则这些节点采用 float64
的默认 numpy 类型,它没有 Conv2D
内核