TensorFlow语法(2)

TensorFlow语法(2)


数学运算

1.矩阵元素运算:+ - * / % (取余) //(整除)
TensorFlow语法(2)
tf.math.log( )、tf.exp( )
TensorFlow语法(2)

tf.pow( )幂次方、tf.sqrt( )平方根
TensorFlow语法(2)

2.矩阵运算:@,tf.matmul( )都表示矩阵相乘。
TensorFlow语法(2)

维度变换

1.tf.reshape( )重塑张量。
TensorFlow语法(2)
将[4,784,3]恢复成[4,28,28,3],需要额外的信息(height和weight)
TensorFlow语法(2)
2.tf.transposer( )转置
TensorFlow语法(2)
TensorFlow语法(2)
3.tf.exand_dims( )增加维度
a表示要增加维度的原数据,axis指定增加维度的索引位置。
TensorFlow语法(2)
4.tf.squeeze( )删除维度为1的维度
axis表示维度为1的位置的索引。
TensorFlow语法(2)