tf.train.get_global_step() 在 TensorFlow 中有什么作用? [英] What does tf.train.get_global_step() do in TensorFlow?

查看:30
本文介绍了tf.train.get_global_step() 在 TensorFlow 中有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TensorFlow 中的函数 tf.train.get_global_step() 有什么用?在机器学习概念中,它相当于什么?

What is the use of the function tf.train.get_global_step() in TensorFlow? In machine learning concepts what is it equivalent to?

推荐答案

当训练过程因某种原因停止时,您可以使用它从上次中断的地方重新开始训练.当然,你总是可以在不知道 global_step 的情况下重新开始训练(如果你在代码中定期保存检查点,那就是),但除非你以某种方式跟踪你已经执行了多少迭代,否则你不会知道重启后还剩下多少迭代.有时你真的希望你的模型精确地训练 n 次迭代,而不是 n 加上 崩溃前未知量.所以在我看来,这更像是一种实用性,而不是理论上的机器学习概念.

You could use it to restart training exactly where you left off when the training procedure has been stopped for some reason. Of course you can always restart training without knowing the global_step (if you save checkpoints regularly in your code, that is), but unless you somehow keep track of how many iterations you already performed, you will not know how many iterations are left after the restart. Sometimes you really want your model to be trained exactly n iterations and not n plus unknown amount before crash. So in my opinion, this is more of a practicality than a theoretical machine learning concept.

这篇关于tf.train.get_global_step() 在 TensorFlow 中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆