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

Operations

The TensorFlow library contains several built-in operations that can be applied on tensors. An operation node can be defined by passing input values and saving the output in another tensor. To understand this better, let's define two operations, op1 and op2:

op1 = tf.add(const2, const3)
op2 = tf.multiply(const2, const3)

Let's print op1 and op2:

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

The output is as follows, and shows that op1 and op2 are defined as tensors:

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

To print the output from executing these operations, the op1 and op2 tensors have to be executed in a TensorFlow session:

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

The output is as follows:

run(op1) :  91.0
run(op2) :  1888.0

Some of the built-in operations of TensorFlow include arithmetic operations, math functions, and complex number operations.

主站蜘蛛池模板: 三明市| 太保市| 泗洪县| 神木县| 长武县| 若尔盖县| 北流市| 芦山县| 桂阳县| 固镇县| 额尔古纳市| 秦皇岛市| 塔城市| 新兴县| 西青区| 安阳县| 龙江县| 金昌市| 兖州市| 精河县| 开原市| 深州市| 新丰县| 高陵县| 巴林右旗| 南木林县| 兴安盟| 金溪县| 蓬溪县| 阳朔县| 喜德县| 平罗县| 苏尼特左旗| 桦南县| 龙泉市| 黄冈市| 柳河县| 肥乡县| 诸暨市| 吉林市| 隆德县|