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

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:

主站蜘蛛池模板: 陕西省| 图们市| 盐津县| 宜黄县| 贡觉县| 大竹县| 达日县| 太原市| 六盘水市| 衡水市| 班玛县| 华蓥市| 丹江口市| 苏州市| 青冈县| 雅安市| 卢湾区| 晋中市| 蒲江县| 康平县| 若尔盖县| 金沙县| 奇台县| 南皮县| 颍上县| 久治县| 南川市| 石棉县| 邮箱| 临安市| 长葛市| 靖宇县| 称多县| 汤阴县| 利津县| 平凉市| 哈尔滨市| 嘉义县| 分宜县| 铁岭县| 石楼县|