1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| import tensorflow as tf import numpy as np
a_l = [1,2,3,4] a_np = np.array([1,2,3,4]) a_tf = tf.constant([1,2,3,4])
b_l = tf.reduce_prod(a_l) b_np = tf.reduce_prod(a_np) b_tf = tf.reduce_prod(a_tf)
sess=tf.Session() sess.run(tf.global_variables_initializer())
print(sess.run([b_l,b_np,b_tf]))
|