tf.transpose函数中文意思是转置,对于低维度的转置问题,很简单,不想讨论,直接转置就好(大家看下面文档,一看就懂). tf.transpose(a, perm=None, name='transpose') Transposes a. Permutes the dimensions according to perm. The returned tensor's dimension i will correspond to the input dimension perm[i]. If…
tf.nn.in_top_k组要是用于计算预测的结果和实际结果的是否相等,返回一个bool类型的张量,tf.nn.in_top_k(prediction, target, K):prediction就是表示你预测的结果,大小就是预测样本的数量乘以输出的维度,类型是tf.float32等.target就是实际样本类别的标签,大小就是样本数量的个数.K表示每个样本的预测结果的前K个最大的数里面是否含有target中的值.一般都是取1. 例如: import tensorflow as tf; A =…
tf.split(input, num_split, dimension): dimension指输入张量的哪一个维度,如果是0就表示对第0维度进行切割:num_split就是切割的数量,如果是2就表示输入张量被切成2份,每一份是一个列表. 例如: import tensorflow as tf; import numpy as np; A = [[1,2,3],[4,5,6]] x = tf.split(A, 3, 1) with tf.Session() as sess: c = sess.…
一.tensorflow官方文档内容 transpose( a, perm=None, name='transpose' ) Defined in tensorflow/python/ops/array_ops.py. See the guides: Math > Matrix Math Functions, Tensor Transformations > Slicing and Joining Transposes a. Permutes the dimensions according…
tf.transpose()的用法 一.tensorflow官方文档内容 transpose( a, perm=None, name='transpose' ) Defined in tensorflow/python/ops/array_ops.py. See the guides: Math > Matrix Math Functions, Tensor Transformations > Slicing and Joining Transposes a. Perm…
tf.nn.embedding_lookup函数的用法主要是选取一个张量里面索引对应的元素.tf.nn.embedding_lookup(tensor, id):tensor就是输入张量,id就是张量对应的索引,其他的参数不介绍. 例如: import tensorflow as tf; import numpy as np; c = np.random.random([10,1]) b = tf.nn.embedding_lookup(c, [1, 3]) with tf.Session()…