0

I am studying TensorFlow with Python 2.7.6. https://www.tensorflow.org/versions/master/tutorials/mnist/tf/index.html#tensorflow-mechanics-101

From above page, I can obtain fully_connected_feed.py.

In the file, I see

# And run one epoch of eval.
true_count = 0  # Counts the number of correct predictions.
steps_per_epoch = data_set.num_examples // FLAGS.batch_size

What is the meaning of the "//" operator?

I am trying to find the meaning in API doc, without success. https://www.tensorflow.org/api_docs/python/index.html

sevenOfNine
  • 1,509
  • 16
  • 37

1 Answers1

1

For compatibility with Python 2 and Python 3, TensorFlow consistently uses Python 3 division operators, using a from __future__ import division statement at the top of every file.

As Trejkaz points out in a comment, in Python 3, the // operator means floor division (or integer division): i.e. the result is equivalent to floor(data_set.num_examples / FLAGS.batch_size).

Community
  • 1
  • 1
mrry
  • 125,488
  • 26
  • 399
  • 400
  • Thank you very much for the keyword "floor division", which says what kind of interger division is used. This will help me to understand more. – sevenOfNine Oct 12 '16 at 23:25