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

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:

主站蜘蛛池模板: 徐闻县| 渭南市| 平罗县| 平远县| 治县。| 沅江市| 高密市| 河南省| 龙岩市| 平山县| 五华县| 遵化市| 胶州市| 朝阳县| 内江市| 阳泉市| 林芝县| 兴安县| 肇源县| 兰坪| 桂东县| 佛坪县| 逊克县| 闽侯县| 武威市| 海晏县| 霞浦县| 沅陵县| 凤山县| 榆中县| 博湖县| 扬州市| 全南县| 潮州市| 新龙县| 云龙县| 永靖县| 张家界市| 定结县| 夏河县| 本溪市|