train.py 文件源码

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

项目:chinese-char-rnn 作者: indiejoseph 项目源码 文件源码
def run_epochs(sess, x, y, model, is_training=True):
  start = time.time()
  feed = {model.input_data: x, model.targets: y, model.is_training: is_training}

  if is_training:
    extra_op = model.train_op
  else:
    extra_op = tf.no_op()

  fetchs = {"loss": model.loss,
            "extra_op": extra_op}

  res = sess.run(fetchs, feed)
  end = time.time()

  return res, end - start
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号