1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import tensorflow as tf
x = tf.constant([[1,1], [2,2], [3,3]],dtype=tf.float32)
b = tf.constant([-1,-1],dtype=tf.float32)
y = tf.nn.bias_add(x,b)
with tf.Session() as sess: sess.run(tf.global_variables_initializer()) value_y = sess.run(y) print("value_y: \n",value_y) ''' value_y: [[0. 0.] [1. 1.] [2. 2.]] '''
|