
Tensorflow使用
Bingoyear
自信人生二百年,会当击水三千里。
展开
-
dataset中shuffle()、repeat()、batch()用法
import numpy as np import tensorflow as tf np.random.seed(0) x = np.random.sample((11,2)) # make a dataset from a numpy array print(x) dataset = tf.data.Dataset.from_tensor_slices(x) dataset = datase...原创 2018-11-22 15:43:11 · 26140 阅读 · 3 评论 -
tensorboard常用API总结
1、tf.summary.image(name, tensor, max_outputs=3, collections=None, family=None) 可视化当前使用的训练、测试图片 参数: name:生成的节点的名称。也将作为TensorBoard中的系列名称。 tensor:uint8或者float32型的4-D Tensor[batch_size, height, width, ch...原创 2019-04-23 15:29:36 · 753 阅读 · 0 评论 -
tf.get_variable_scope().reuse_variables() 的使用
tf.name_scope()对tf.get_variable_scope().reuse_variables() 不起作用 # tf.get_variable_scope().reuse_variables() 的使用 import tensorflow as tf with tf.variable_scope('a1'): print(tf.get_variable_scope()....原创 2019-04-29 14:27:44 · 6717 阅读 · 1 评论 -
ValueError: Rank mismatch: Rank of labels (received 2) should equal rank of logits minus 1 (received
多分类任务时, tf.nn.sparse_softmax_cross_entropy_with_logits for batchTrain in nextBatch(trainX, trainlabels, config.batchSize): print(batchTrain[0]) # 32 *type_num print(batchTrain[1]) # 32 * 1 ...原创 2019-04-24 21:53:15 · 5438 阅读 · 0 评论 -
Tensor had NaN values
loss出现nan值,加上梯度的取值范围后,出现Tensor had NaN values 1、调低学习率为0.0001和0.00001后,依然出现Tensor had NaN values 2、查看模型中是否有除数为0的情况。范数为0 ...原创 2019-06-18 21:09:43 · 1028 阅读 · 0 评论