What is the relationship between steps and epochs in TensorFlow?

后端 未结 5 1492
鱼传尺愫
鱼传尺愫 2020-12-22 19:07

I am going through TensorFlow get started tutorial. In the tf.contrib.learn example, these are two lines of code:

input_fn = tf.contrib.learn.io         


        
5条回答
  •  我在风中等你
    2020-12-22 20:03

    Epoch: One pass through the entire data.

    Batch size: The no of examples seen in one batch.

    If there are 1000 examples and the batch size is 100, then there will be 10 steps per epoch.

    The Epochs and batch size completely define the number of steps.

    steps_cal = (no of ex / batch_size) * no_of_epochs

    estimator.fit(input_fn=input_fn)
    

    If you just write the above code, then the value of 'steps' is as given by 'steps_cal' in the above formula.

    estimator.fit(input_fn=input_fn, steps  = steps_less)
    

    If you give a value(say 'steps_less') less than 'steps_cal', then only 'steps_less' no of steps will be executed.In this case, the training will not cover the entire no of epochs that were mentioned.

    estimator.fit(input_fn=input_fn, steps  = steps_more)
    

    If you give a value(say steps_more) more than steps_cal, then also 'steps_cal' no of steps will be executed.

提交回复
热议问题