0
私はTensorFlowでプレイし始めました。私はtf.nn.softmax
をtf.placeholder
と連動させることができません。このコードは、TensorFlow - プレースホルダーのsoftmax
import tensorflow as tf
import numpy as np
shape = [1, 3]
value = 0.
probs = tf.constant(value, shape=shape)
sampling_prob = tf.nn.softmax(probs)
with tf.Session() as sess:
print(sess.run(sampling_prob))
となります。[[ 0.33333334 0.33333334 0.33333334]]
を返します。しかし、私がそれを変更すると:
probs2 = tf.placeholder(tf.float32, shape=shape)
sampling_prob2 = tf.nn.softmax(probs2)
with tf.Session() as sess:
print(sess.run(sampling_prob2, feed_dict={probs2: np.full(shape, value)}))
突然私は[[ 0. 0. 0.]]
を得ます。どのようにそれを可能にすることができますか? Windowsの10、Pythonの3.5.2、TensorFlow 0.12、CUDA 8
Ubuntu 14.04、Python 2.7、TensorFlow 0.11 CPUのみが正しく動作しています – martianwars