Kid*_*g_C 5 tensorflow tensorflow-estimator
我真的对tf.estimator.inputs.numpy_input_fn
这里的tensorflow估计器的文档感到困惑,尤其是关于以下内容的行num_epochs
:
num_epochs: Integer, number of epochs to iterate over data. If None will run forever.
如果我设置num_epochs
到None
,培训会永远运行下去?
它永远运行意味着什么?
这对我来说没有意义,因为我无法想象人们会以可能永远运行的方式设计程序。
有人可以解释吗?
回答我自己的问题:我想我已经在这里找到答案了:https : //www.tensorflow.org/versions/r1.3/get_started/input_fn#evaluating_the_model
具体来说,在该部分中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.
如果num_epochs
是None
,您的代码将无限迭代数据集。它将永远运行,让您可以随时手动停止训练。例如,您可以手动监控训练和测试损失(和/或任何其他指标),以便在模型收敛或开始过度拟合时停止训练。
归档时间: |
|
查看次数: |
723 次 |
最近记录: |