-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use six library to ensure pycaffe.py python3 compliance #3716
Conversation
remainder = num % batch_size | ||
num_batches = num / batch_size | ||
num_batches = int(num / batch_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use //
to get integer divide for both python2
and python3
.
Use // for integer division (python2 and python3 compliant) |
CI build fails because of random 404 on package download from repo.continuum.io: https://repo.continuum.io/pkgs/free/linux-64/setuptools-20.1.1-py35_0.tar.bz2 |
@@ -14,6 +14,9 @@ | |||
RMSPropSolver, AdaDeltaSolver, AdamSolver | |||
import caffe.io | |||
|
|||
# py3 compliance | |||
from six import itervalues, next, iteritems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'd rather we make our use of six
explicit by just doing import six
here... I think that's how we already do it in other files, and six
is pretty short, and I think it's easier to read that way.
You can also drop the comment, IMO... we all know what six
does, and anyone who is not familiar with it can find out easily.
Looks good except as noted. We should really have tests that cover these cases... |
Great, the diff looks good to me now. If you could clean up the history by squashing into a single commit, this will be ready for merge. |
@ttdt in the future do not close the PR, but instead update the PR by force pushing to your branch. Making new PRs adds noise to the tracker. |
Use '//' instead of '/' for entire division.
Thanks for the Python 3 update, merging! (By the way, I think you mean "integer division" or "floor division" in the commit message (but it's not worth fixing, just a note for the future)). |
Use six library to ensure pycaffe.py python3 compliance
Use six library to ensure pycaffe.py python3 compliance
By replacing itervalues, next and iteritems with six library functions, pycaffe.py is now python3 compliant.