import tensorflow as tf
import numpy as np
a = np.array([[0,0,1], [1,1,1], [1000,200,300], [-3000,-0.2,0]])
k = tf.placeholder(tf.float32, [None,3])
w = tf.Variable(tf.random_normal([3,1]))
b = tf.Variable(tf.ones([1,1]))
model = tf.nn.softmax(tf.matmul(k,w)+b)
with tf.Session() as sess:
tf.global_variables_initializer().run()
print(sess.run(model, {k:a}))
[[ 1.]
[ 1.]
[ 1.]
[ 1.]]
我不明白爲什麼我總是收到1,沒有輸入的事,不管我是否有偏差B ...任何想法?將不勝感激。