2016-10-10 36 views
0

我正在用Python 2.7.6學習TensorFlow。 https://www.tensorflow.org/versions/master/tutorials/mnist/tf/index.html#tensorflow-mechanics-101fully_connected_feed.py中「//」的含義

從上面的頁面,我可以獲得fully_connected_feed.py。

在該文件中,我看到

# 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 

什麼是 「//」 運算符的含義是什麼?

我想找到API文檔中的含義,但沒有成功。 https://www.tensorflow.org/api_docs/python/index.html

+4

根本不知道任何python,它是整數除法嗎? – Trejkaz

+0

我加了python 2.7.6。 – sevenOfNine

+0

隨着您的評論「整數師」,我可以找到信息。非常感謝你。 http://stackoverflow.com/questions/183853/in-python-what-is-the-difference-between-and-when-used-for-division – sevenOfNine

回答

1

爲了與Python 2和Python 3兼容,TensorFlow一直使用Python 3除法運算符,在每個文件的頂部使用from __future__ import division語句。

作爲Trejkaz points out in a comment,在Python 3中,操作者//裝置floor division(或整數除法):即,結果等於floor(data_set.num_examples/FLAGS.batch_size)

+0

非常感謝關鍵詞「floor division」,它說使用什麼樣的整數分割。這將幫助我瞭解更多。 – sevenOfNine