keras 在train_on_batch中启用tensorboard

def write_log(callback, names, logs, batch_no):
    for name, value in zip(names, logs):
        summary = tf.Summary()
        summary_value = summary.value.add()
        summary_value.simple_value = value
        summary_value.tag = name
        callback.writer.add_summary(summary, batch_no)
        callback.writer.flush()

在训练的时候,调用上述函数,写入tensorboard

  loss = model.train_on_batch([x1,x2],y)
  write_log(tensorboard_cb,["trainloss","me"],loss,bathNo)

 

上一篇:Codeforces 1220


下一篇:【ERR_CERT_INVALID】chrome允许自签名