Tensorflow实战-张量

import tensorflow as tf
#tf.constant 是一个计算,这个计算的结果为一个张量,保存在变量a中。
a = tf.constant([1.0,2.0],name="a")
b = tf.constant([2.0,3.0],name="b")
result = tf.add(a,b,name="add")
print (result)
'''
#输出:
Tensor("add:0",shape=(2,),dtpye=float32)
"add:0"说明了result这个张量是计算节点"add"输出的第一个结果
张量的第二个属性是张量的维度(shape)
张量的第三个属性是类型(type),每个张量会有一个唯一的类型

猜你喜欢

转载自blog.csdn.net/s11092114/article/details/83870097