官术网_书友最值得收藏!

Operations

TensorFlow provides us with many operations that can be applied on Tensors. An operation is defined by passing values and assigning the output to another tensor. For example, in the provided Jupyter Notebook file, we define two operations, op1 and op2:

op1 = tf.add(c2,c3)
op2 = tf.multiply(c2,c3)

When we print op1 and op2, we find that they are defined as Tensors:

print('op1 : ', op1)
print('op2 : ', op2)

The output is as follows:

op1 :  Tensor("Add:0", shape=(), dtype=float32)
op2 : Tensor("Mul:0", shape=(), dtype=float32)

To print the value of these operations, we have to run them in our TensorFlow session:

print('run(op1) : ', tfs.run(op1))
print('run(op2) : ', tfs.run(op2))

The output is as follows:

run(op1) :  13.0
run(op2) : 42.0

The following table lists some of the built-in operations:

主站蜘蛛池模板: 汤原县| 石泉县| 简阳市| 石柱| 兰州市| 沾化县| 大新县| 奉贤区| 登封市| 包头市| 惠来县| 庆安县| 乌审旗| 晋州市| 大同县| 抚远县| 连云港市| 冕宁县| 酉阳| 磐石市| 惠水县| 辉县市| 华宁县| 武邑县| 册亨县| 佛教| 兰坪| 繁峙县| 新乡县| 河池市| 剑川县| 达日县| 仲巴县| 钟山县| 肇庆市| 南华县| 凤山县| 瓦房店市| 宜兰市| 金塔县| 青田县|