2016-12-24 30 views
1

新的這可能是一些愚蠢的,但不能讓conv2d運行沒有OpKernel登記支持歐普 'Conv2D' 這些ATTRS


窗口10

蟒蛇4.2.13

python 3.5.2

C:\ windows \ system32> nvcc --version nvcc:NVIDIA(R)Cuda編譯器驅動程序 Copyright(c)2005-2016 NV IDIA公司 建立在Sat_Sep__3_19:05:48_CDT_2016 Cuda的彙編工具,8.0版,V8.0.44

cudnn 5.1

TensorFlow 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)]] 

回答

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) ) 

否則這些節點採取默認numpy的類型float64,不具有Conv2D內核

+0

謝謝!我在這方面花了太長時間,但文檔說它在tensorflow網站上花了64位。 –

+0

你是對的,這有點令人困惑,發送https://github.com/tensorflow/tensorflow/pull/6485修復 –

相關問題