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

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:

主站蜘蛛池模板: 东城区| 从江县| 汉沽区| 陇川县| 沂南县| 镇赉县| 顺平县| 宜良县| 景德镇市| 隆子县| 洪湖市| 新和县| 南阳市| 汶川县| 瑞丽市| 鹤庆县| 沙雅县| 武安市| 泉州市| 奉化市| 宜城市| 云霄县| 襄樊市| 郎溪县| 轮台县| 明光市| 陆河县| 泌阳县| 濉溪县| 丹阳市| 闽侯县| 怀远县| 铁力市| 米泉市| 沅陵县| 搜索| 宣化县| 陇南市| 忻城县| 凯里市| 沧州市|