蜗牛kuai快跑

导航

tensorflow o. 到 tensorflow 1. 部分改变

一下内容为笔者实际应用中遇到的问题,可能(必须)不全,后面会持续更新。

(1) tf.nn.run_cell   改为   tf.contrib.rnn

(2) tf.reduce_mean   改为   tf.reduce.sum

(3) tf.nn.seq2seq.sequence_loss_by_example    改为

     tf.contrib.legacy_seq2seq.sequence_loss_by_example

(4) tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logit(y,y_))   改为

     tf.reduce_sum(tf.nn.softmax_cross_entropy_with_logit(logits=logits,labels=y_))

(5) tf.train.SummaryWriter   改为:   tf.summary.FileWriter

(6) tf.merge_all_summary()   改为:   tf.summary.merge_all()

(7) tf.histogram_summary()   改为:   tf.summary.histogram()

(8) tf.scalar_summary()   改为:   tf.summary.scalar()

(9) tf.image_summary()   改为:   tf.summary.image()

(10) tf.concat(1,[indices,sparse_labels])   改为:   tf.concat([indices,sparse_labels],1)

(11) TypeError: Using a `tf.Tensor` as a Python `bool` is not allowed. Use `if t is not None:` instead of `if t:` to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.

if grad:    改为     if grad is not None:

posted on 2017-04-19 14:29  蜗牛kuai快跑  阅读(775)  评论(0编辑  收藏  举报