Je viens de commencer à jouer avec TensorFlow. Je suis incapable d'obtenir tf.nn.softmax
en cours d'exécution avec tf.placeholder
. Ce morceau de code:TensorFlow - softmax sur un espace réservé
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))
comme prévu, renvoie [[ 0.33333334 0.33333334 0.33333334]]
. Mais quand je le change en:
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)}))
soudainement j'obtiens [[ 0. 0. 0.]]
. Comment cela peut-il être possible?
exécution sur Windows 10, Python 3.5.2, tensorflow 0,12, CUDA 8.
Cela fonctionne correctement pour moi, Ubuntu 14.04, Python 2.7, CPU TensorFlow 0.11 seulement – martianwars