我正在使用Tensorflow來培訓CNN。我目前正在計算Float32,這是初始化變量時的默認值。Tensorflow MaxPool不接受float64
我猜想,通過使用float64
作爲我的D類,所以我改變了我的varibales的動初始化如下,我可以得到更準確的結果:
w1 = tf.Variable(tf.random_normal([5, 5, 3, 64], stddev=0.1, dtype=tf.float64))
但我得到以下的maxpool
操作錯誤: 我chacked maxpool
文檔和它接受值類型如下: value: A 4-D Tensor with shape [batch, height, width, channels] and type float32, float64, qint8, quint8, qint32.
但我得到以下錯誤。這是一個錯誤還是我做錯了什麼?
Input 'input' of 'MaxPool' Op has type float64 that does not match expected type of float32.
Traceback (most recent call last):
File "/Users/hamedketabdar/LearningTensorFlow/CIFAR-Khodam/convolutional_network_batch_2d2c_clean_64f.py", line 213, in <module>
pred = conv_net(x, weights, biases, keep_prob)
File "/Users/hamedketabdar/LearningTensorFlow/CIFAR-Khodam/convolutional_network_batch_2d2c_clean_64f.py", line 153, in conv_net
conv1 = max_pool(conv1, k=2) # Normally K=2
File "/Users/hamedketabdar/LearningTensorFlow/CIFAR-Khodam/convolutional_network_batch_2d2c_clean_64f.py", line 135, in max_pool
return tf.nn.max_pool(img, ksize=[1, k, k, 1], strides=[1, k, k, 1], padding='SAME')
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 235, in max_pool
name=name)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 449, in _max_pool
strides=strides, padding=padding, name=name)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/op_def_library.py", line 430, in apply_op
(prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'input' of 'MaxPool' Op has type float64 that does not match expected type of float32.
已開通問題:https://github.com/tensorflow/tensorflow/issues/547 –
我給自己打開了這個問題 – user2576346
謝謝。我添加了鏈接,以便其他人可以找到它。不是每個人都知道在那裏看。 –