2016-12-27 6 views
2

のIMを使用していないuができるように、モデルは、は、ソフトマックス関数は文書続くMNISTソフトマックスチュートリアル<a href="https://www.tensorflow.org/tutorials/mnist/beginners/" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/mnist/beginners/</a></p> <p>以下

y = tf.nn.softmax(tf.matmul(x, W) + b) 

が、サンプルソースコードであるべきです

# Create the model 
x = tf.placeholder(tf.float32, [None, 784]) 
W = tf.Variable(tf.zeros([784, 10])) 
b = tf.Variable(tf.zeros([10])) 
y = tf.matmul(x, W) + b 

softmaxが使用されていません。私はそれが私はそれが0〜1.0の値に正規化する必要がないように、テスト機能で、それはARGMAXを使用しています、と仮定し

y = tf.nn.softmax(tf.matmul(x, W) + b) 

を変更する必要があると思います。しかし、それは開発者にいくらかの混乱をもたらす可能性があります。

これについてのアイデアは?ソフトマックスが使用さ

答えて

2

、行57:

# So here we use tf.nn.softmax_cross_entropy_with_logits on the raw 
# outputs of 'y', and then average across the batch. 
cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(y, y_)) 

詳しくはsoftmax_cross_entropy_with_logitsを参照してください。

関連する問題