张量:多维数组
tf.zeros()
tf.ones()
tf.fill([2,2],a)
tf.constant(内容,dtype=数据类型)
tf.random.normal(维度,mean=均值,stddev=标准差)
tf.random.trancated_normal()
tf.random.uniform(维度,minval=,maxval=)
tf.cast(张量名,dtype=)
计算与查找
tf.add()
tf.subtract()
tf.multiply()
tf.divide()
tf.square()
tf.pow()
tf.sqrt()
tf.matmul()
tf.reduce_min(张量名)
tf.reduce_max()
tf.reduce_mean()
tf.reduce_sum(张量名,axis=)
tf.argmax(张量名,axis=维度)
tf.where(条件,A,B)
tf
神经网络相关
tf.data.Dataset.from_tensor_slices((输入特征,标签))
tf.GradientTape()
grad=tf.GradientTape().gradient(函数,求导对象)
tf.one_hot(待转换数据,depth=分类数)
tf.Variable()
w.assign_sub()
tf.nn.sigmoid(x)
tf.nn.relu(x)
tf.losses.categorical_crossentropy(y_,y)
tf.nn.softmax_cross_entropy_with_logits(y_,y)