tensorflow学习笔记一

import tensorflow as tf
import numpy as np
a=tf.placeholder(tf.int32,shape=[2],name=‘my_input’)
b=tf.reduce_prod(a,name=‘prod_b’)
c=tf.reduce_sum(a,name=‘sum_c’)
d=tf.add(b,c,name=‘add_d’)
with tf.Session() as sess:
input_dict={a:np.array([5,3],dtype=np.int32)}
print(sess.run(d,feed_dict=input_dict))
//tf.reduce_all - 逻辑和,tf.reduce_any - 逻辑或,tf.reduce_max - 最大值,tf.reduce_mean - 均值,
// tf.reduce_min - 最小值,tf.reduce_prob - 元素乘积,tf.reduce_sum - 元素和


版权声明:本文为oPippo原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。