train_lstm.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:last_layer 作者: thtrieu 项目源码 文件源码
def train_step(x_batch, y_batch):
            """
            A single training step
            """
            feed_dict = {
              lstm.input_x: x_batch,
              lstm.input_y: y_batch,
              lstm.dropout_keep_prob: FLAGS.dropout_keep_prob,
              lstm.batch_size: FLAGS.batch_size,
              lstm.real_len: real_len(x_batch)
            }
            _, step, summaries, loss, accuracy = sess.run(
                [train_op, global_step, train_summary_op, lstm.loss, lstm.accuracy],
                feed_dict)
            lstm.W = tf.clip_by_norm(lstm.W, 3)
            time_str = datetime.datetime.now().isoformat()
            print("TRAIN step {}, loss {:g}, acc {:g}".format(step, loss, accuracy))
            train_summary_writer.add_summary(summaries, step)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号