tf.nn.xw_plus_b((x, weights) + biases)
相当于tf.matmul(x, weights) + biases
#-*-coding:utf8-*-
import tensorflow as tf
x=[[1, 2, 3],[4, 5, 6]]
w=[[ 7, 8],[ 9, 10],[11, 12]]
b=[[3,3],[3,3]]
result1=tf.nn.xw_plus_b(x,w,[3,3])
result2=tf.matmul(x, w) + b
init_op = tf.initialize_all_variables()
with tf.Session() as sess:
# Run the init operation.
sess.run(init_op)
print(sess.run(result1))
print(sess.run(result2))
输出:
[[ 61 67]
[142 157]]
[[ 61 67]
[142 157]]