2016-12-12 2 views
0

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.

+0

Cela fonctionne correctement pour moi, Ubuntu 14.04, Python 2.7, CPU TensorFlow 0.11 seulement – martianwars

Répondre

0

code fonctionne bien pour moi (Ubuntu, Python 2, GPU tensorflow 0.11, CUDA 8). Le support de Windows pour TensorFlow est vraiment nouveau (dans un mois environ) - il semble que vous souhaitiez le mentionner dans leurs numéros: https://github.com/tensorflow/tensorflow/issues.