对于tensorflow估计器tf.estimator.inputs.numpy_input_fn
这里的文档,特别是关于num_epochs
上的行,我真的很困惑
num_epochs: Integer, number of epochs to iterate over data. If None will run forever.
如果我将num_epochs
设置为None
,培训将永远运行?
它永远运行到底意味着什么??
这对我来说毫无意义,因为我无法想象人们设计这个程序的方式可能会永远运行下去。
有人能解释一下吗?
回答我自己的问题:我想我在这里找到了答案:模型
具体来说,在Building the input_fn
部分
Two additional arguments are provided: num_epochs: controls the number of epochs to iterate over data. For training, set this to None, so the input_fn keeps returning data until the required number of train steps is reached. For evaluate and predict, set this to 1, so the input_fn will iterate over the data once and then raise OutOfRangeError. That error will signal the Estimator to stop evaluate or predict.
发布于 2018-04-10 13:27:36
如果num_epochs
是None
,则代码将无限地迭代数据集。它将永远运行,允许您随时手动停止训练。例如,您可以手动监视您的培训和测试损失(和/或任何其他指标),以便在模型收敛或开始过度拟合时停止培训。
https://stackoverflow.com/questions/49761611
复制