总结
- tf.nn.softmax(…) 需要什么样的输入
- tf.nn.softmax(…) 输出是什么
- softmax本身想干什么
import tensorflow as tf
X = tf.constant([[1,2,3], [3,2,4]], dtype=tf.float32)
W = tf.constant([[1,1],[2,2],[3,3]], dtype=tf.float32)
bias = tf.constant([1, 2], dtype=tf.float32)
y = tf.nn.softmax(tf.matmul(X, W) + bias)
with tf.Session() as sess:
print(sess.run(y))
"""
[[0.26894143 0.7310586 ]
[0.26894143 0.7310586 ]]
"""
- X的列表示单个样本的特征数,W的列表示分类数(eg:10分类 W矩阵有10列)
- X的行表示样本数
- W的行(画图)
- 陈后乘后矩阵的含义(画图)