Skip to content

Conversation

justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Sep 30, 2025

Fix aten_floor_divide for negative int inputs and large int inputs. I also combined the int and float overloads for #2580

Fix #2589

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Sep 30, 2025
@justinchuby justinchuby added this to the 0.5.3 milestone Sep 30, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the aten_floor_divide operator implementation to properly handle integer inputs, particularly negative and large integer values. The changes consolidate two separate floor divide functions into a single implementation that handles both floating-point and integer types correctly.

  • Consolidated aten_floor_divide and aten_floor_divide_int into a single function
  • Added proper handling for signed vs unsigned integer division
  • Implemented correct floor division logic for signed integers using offset calculation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/function_libs/torch_lib/ops_test_data.py Removed the separate integer floor divide test entry
tests/function_libs/torch_lib/extra_opinfo.py Consolidated test configuration to support all types and removed integer-specific constraints
onnxscript/function_libs/torch_lib/ops/core.py Unified floor divide implementation with proper integer handling logic

@justinchuby justinchuby requested a review from xadupre September 30, 2025 22:18
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.06%. Comparing base (7227655) to head (0a053b0).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
onnxscript/function_libs/torch_lib/ops/core.py 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2592      +/-   ##
==========================================
- Coverage   70.07%   70.06%   -0.01%     
==========================================
  Files         223      223              
  Lines       26266    26266              
  Branches     2602     2604       +2     
==========================================
- Hits        18405    18403       -2     
- Misses       6950     6951       +1     
- Partials      911      912       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-project-automation github-project-automation bot moved this from Todo to Done in ONNX Script Review Board Oct 1, 2025
@justinchuby justinchuby merged commit 88b03d8 into main Oct 1, 2025
32 checks passed
@justinchuby justinchuby deleted the justinchu/floor-divide-int branch October 1, 2025 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: torchlib Related to the torch/aten function lib in development
Projects
Development

Successfully merging this pull request may close these issues.

aten_floor_divide_int may cause precision loss
2 participants