赞
踩
#!/usr/bin/python
import tensorflow as tf
x1 = tf.placeholder(tf.int32,shape=[1],name='x1')
x2 = tf.constant(5,name = 'x2')
result = x1 + x2
with tf.Session() as sess:
print(sess.run(result,{x1:[3]}))
x1 定义为placeholder
x2定义为constant
dtype: The type of elements in the tensor to be fed.
shape: The shape of the tensor to be fed (optional). If the shape is not specified, you can feed a tensor of any shape.
name: A name for the operation (optional).
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。