Math
Arithmetic Operators
tf.add(x, y, name =None)
tf.subtract(x, y, name =None)
tf.multiply(x, y, name =None)
tf.div (x, y, name =None)
tf.mod (x, y, name =None)
Basic Math Functions
tf.abs(x, name =None)
tf.negative(x, name =None)
tf.sign(x, name =None)
tf.square(x, name =None)
tf.sqrt(x, name =None)
tf.pow(x, y, name =None)
tf.exp(x, name =None)
tf.log (x, y, name =None)
tf.ceil(x, name =None)
tf.floor(x, name =None)
tf.round (x, name =None)
tf.maximum(x, y, name =None)
tf.minimum(x, y, name =None)
tf.sin(x, name =None)
tf.cos(x, name =None)
tf.tan(x, name =None)
tf.atan(x, name =None)
Matrix Math Functions
tf.diag(diagonal, name=None )
tf.diag_part(input,name=None )
tf.transpose(a, perm=None , name='transpose' )
tf.tf.matmul(a,b,name=None )
tf.matrix_determinant(input,name=None )
tf.matrix_inverse(input,adjoint=None ,name=None )
tf.cholesky(input,name=None )
qr(input,full_matrices=None ,name=None )
svd(tensor,full_matrices=False ,compute_uv=True ,name=None )
Tensor Math Function
tf.tensordot(a, b, axes, name=None )
Complex Number Functions
tf.complex(real, imag, name=None )
tf.conj(x, name=None )
tf.imag(input,name=None )
tf.real(input,name=None )
Reduction
tf.reduce_sum(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.reduce_prod(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.reduce_min(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.reduce_max(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.reduce_mean(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.reduce_all(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.reduce_any(input_tensor, reduction_indices=None , keep_dims=False , name=None )
tf.accumulate_n(inputs, shape=None , tensor_dtype=None , name=None )
tf.accumulate_n([a, b, a])
Scan
tf.cumsum(x, axis=0 , exclusive=False , reverse=False , name=None )
tf.cumsum([a, b, c]) ==> [a, a + b, a + b + c]
tf.cumsum([a, b, c], exclusive=True ) ==> [0 , a, a + b]
tf.cumsum([a, b, c], reverse=True ) ==> [a + b + c, b + c, c]
tf.cumsum([a, b, c], exclusive=True , reverse=True ) ==> [b + c, c, 0 ]
tf.cumprod(x, axis=0 , exclusive=False , reverse=False , name=None )
tf.cumprod([a, b, c]) ==> [a, a * b, a * b * c]
tf.cumprod([a, b, c], exclusive=True ) ==> [0 , a, a * b]
tf.cumprod([a, b, c], reverse=True ) ==> [a * b * c, b * c, c]
tf.cumprod([a, b, c], exclusive=True , reverse=True ) ==> [b * c, c, 0 ]
Segmentation
tf.segment_sum(data, segment_ids, name=None) # 沿着segment_ids指定维度分割张量,并累加求和
# c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]] )
# tf.segment_sum(c, tf.constant([0 , 0 , 1 ])) ==> [[0 0 0 0] [5 6 7 8]]
# [1 , 2 , 3 , 4 ] + [-1 , -2 , -3 , -4 ] = [0 , 0 , 0 , 0 ] , [5 , 6 , 7 , 8 ]=[5 , 6 , 7 , 8 ]
tf.segment_prod(data, segment_ids, name=None) # 沿着segment_ids指定维度分割张量,并累加求积
tf.segment_min(data, segment_ids, name=None) # 沿着segment_ids指定维度分割张量,并取最小值
tf.segment_max(data, segment_ids, name=None) # 沿着segment_ids指定维度分割张量,并取最大值
tf.segment_mean(data, segment_ids, name=None) # 沿着segment_ids指定维度分割张量,并取平均值
tf.unsorted_segment_sum(data, segment_ids,num_segments, name=None) # 与tf.segment_sum函数类似,但segment_ids可以无序
tf.sparse_segment_sum(data, indices, segment_ids, name=None) # 先选取,再分割
Sequence Comparison and Indexing
tf.argmin(input, dimension, name=None )
tf.argmax(input, dimension, name=None )
tf.setdiff1d(x, y, index_dtype=tf.int32, name=None )
tf.where(input, name=None )
tf.unique(x, name=None )
tf.invert_permutation(x, name=None )