-
Notifications
You must be signed in to change notification settings - Fork 27.7k
floor_divide truncates instead of flooring #43874
Copy link
Copy link
Closed
Labels
high prioritymodule: correctness (silent)issue that returns an incorrect result silentlyissue that returns an incorrect result silentlymodule: deprecationtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
high prioritymodule: correctness (silent)issue that returns an incorrect result silentlyissue that returns an incorrect result silentlymodule: deprecationtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
🐛 Bug
PyTorch's floor_divide (//) operator doesn't match Python's behavior on negative numbers. Python floors (rounds down) while PyTorch truncates (rounds towards zero).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect PyTorch's floor_divide to match Python // operator by flooring division results instead of truncating them.
Environment
cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser