Tensorflow OP介绍

Merge & Switch

TensorFlow提供Switch和Merge两种operator,可以根据某个布尔值跳过某段子图,然后把两段子图的结果合并,实现if-else的功能。同时还提供了Enter、Leave和NextIteration用来实现循环和迭代。在使用高阶语言(比如Python)的if-else、while、for控制计算流程时,这些控制流会被自动编译为上述那些operator,方便了用户。
StackOverflow
Merge

Squeeze

删除数值为1的维度
Squeeze

Permute

根据给定的参数重排数据
Permute

ExpandDims

插入一个值为1的维度
ExpandDims

Batchnorm

批规范化,在每次SGD时,通过mini-batch来对相应的activation做规范化操作,使得结果(输出信号各个维度)的均值为0,方差为1
知乎

Deconvolution

逆卷积,卷积的反向操作
知乎

Matmul

矩阵乘
Matmul

BiasAdd

将bias和value相加,其中bias为一维书局,value为n维数据
BiasAdd

ReduceSum

在指定方向上相加,reduce方向的维度数字会变为1
Reduce

Stack / Unstack

将数据打包 / 解包

x = tf.constant([1, 4])
y = tf.constant([2, 5])
z = tf.constant([3, 6])
tf.stack([x, y, z])  # [[1, 4], [2, 5], [3, 6]] (Pack along first dim.)
tf.stack([x, y, z], axis=1)  # [[1, 2, 3], [4, 5, 6]]

Stack

Concat

沿某一维度连接所有输入tensor

t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 0)  # [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 1)  # [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]

Concat

Cond

condition判断语句
z = tf.multiply(a, b)
result = tf.cond(x < y, lambda: tf.add(x, z), lambda: tf.square(y))
Cond

Softmax

softmax = tf.exp(logits) / tf.reduce_sum(tf.exp(logits), axis)
突出最大值,抑制远小于最大值的输出
Wiki
Softmax

你可能感兴趣的:(Tensorflow OP介绍)