记录一个下最近用tensorflow的几个坑

1,

softmax_cross_entropy_with_logits

的中的logits=x*w+b,其中w应该是[nfeats,nclass],b是[nclass]是对输出的每个类上logits的修正?。 label 应该是[nsamples,nclass](用np.concatenate([yy,1-yy],1)生成one hot)

例如,2分类问题,nclass就是2,

sparse_softmax_cross_entropy_with_logits

的的中的logits=x*w+b,其中w应该是[nfeats,nclass],b是[nclass]。而 label 应该是[nclass]

2

关于tfrecord

feats=batch_inputs()一定要在threads = tf.train.start_queue_runners(sess=sess, coord=coord)的前面,测试的写到后面了,卡住了,非常难调试

3

关于feed_dict,由于tfrecord读入的值就是tenosr,所以不需要feed_dict,直接run[loss]就行了,例子见这个https://github.com/fword/TFrecordsBatch

他还feed一个空的字段,其实完全不需要

原文地址:https://www.cnblogs.com/dmesg/p/6797407.html