-
Notifications
You must be signed in to change notification settings - Fork 64
[IR] Expose the Tape module #2127
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
Conversation
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.
Pull Request Overview
This PR exposes the Tape module as part of the public API for simplified graph construction in the IR and updates shape inference tests to demonstrate its usage.
- Exposes and re-exports the Tape class under onnxscript/ir/tape.py and via onnxscript/ir/init.py.
- Refactors the Tape class in onnxscript/ir/_tape.py to accept additional parameters for op methods.
- Updates shape inference tests to use the new Tape API instead of directly instantiating Node objects.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
onnxscript/ir/tape.py | Introduces the public API for the Tape class and sets its module. |
onnxscript/ir/init.py | Exports the tape module to be part of the IR package’s public API. |
onnxscript/ir/_tape.py | Updates the Tape class and op methods with additional parameters. |
onnxscript/ir/passes/common/shape_inference_test.py | Revises tests to utilize the Tape API for constructing graphs. |
Comments suppressed due to low confidence (2)
onnxscript/ir/_tape.py:99
- In op_multi_output, the 'num_outputs' parameter is now optional and may be None. Ensure that the Node constructor and downstream logic can handle a None value or consider providing a default integer value.
num_outputs: int | None = None,
onnxscript/ir/passes/common/shape_inference_test.py:73
- [nitpick] Consider using the 'inputs' list directly instead of '[*inputs]' for consistency with other tests and to reduce unnecessary overhead.
val_add = tape.op("Add", inputs=[*inputs])
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.
Pull Request Overview
This PR exposes the Tape module to simplify IR graph construction by providing a convenient, secondary API. Key changes include:
- Introducing onnxscript/ir/tape.py to export the Tape class.
- Updating onnxscript/ir/_tape.py with extended op and op_multi_output signatures.
- Modifying tests in onnxscript/ir/passes/common/shape_inference_test.py to demonstrate Tape usage.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
onnxscript/ir/tape.py | Added public API for the Tape module and set the module name. |
onnxscript/ir/_tape.py | Extended the Tape class with additional parameters in methods. |
onnxscript/ir/init.py | Updated exports to include the Tape module. |
onnxscript/ir/passes/common/shape_inference_test.py | Updated tests to use the new Tape API for node operations. |
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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.
Pull Request Overview
This PR exposes the Tape module to simplify graph construction in the IR while updating tests to demonstrate and support the new API.
- Introduces onnxscript/ir/tape.py exposing the Tape class.
- Updates shape inference and initializer tests to use Tape operations.
- Extends the Tape API (and Builder subclass) and updates core type hints to support both Graph and Function types.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
onnxscript/ir/tape.py | Exposes the Tape class with a public API and sets its module. |
onnxscript/ir/passes/common/shape_inference_test.py | Updates tests to use Tape for creating operations and nodes. |
onnxscript/ir/_tape_test.py | Adds tests covering tape operations, initializers, and multi-output. |
onnxscript/ir/_tape.py | Extends the Tape API to include additional parameters and tracks used opsets. |
onnxscript/ir/_core.py | Adjusts type hints for the graph parameter to accept Function objects. |
onnxscript/ir/init.py | Includes the tape module in the public IR API exports. |
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.
Pull Request Overview
This PR exposes the Tape module as part of the public IR API for simplified graph construction and improved testing.
- Introduces onnxscript/ir/tape.py to expose the Tape class.
- Updates tests in onnxscript/ir/passes/common/shape_inference_test.py and onnxscript/ir/_tape_test.py to demonstrate Tape usage.
- Enhances the internal Tape implementation and type hints in onnxscript/ir/_tape.py and onnxscript/ir/_core.py to support both Graph and Function types.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
onnxscript/ir/tape.py | Introduces public Tape API by importing from _tape and exposing it under the ir.tape namespace. |
onnxscript/ir/passes/common/shape_inference_test.py | Updates tests to utilize Tape for node creation and graph construction. |
onnxscript/ir/_tape_test.py | Adds new tests for Tape functionality including operations and multi-output handling. |
onnxscript/ir/_tape.py | Extends Tape implementation with additional parameters, type hints, and used_opsets management. |
onnxscript/ir/_core.py | Updates type hints for the graph parameter to include support for Function objects. |
onnxscript/ir/init.py | Exports the new tape module as part of the public IR API. |
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.
Thanks, nit: lint and rebase
Expose the
Tape
class underir.tape
for simplifying graph construction in the IR. This is a secondary API for convenience. I updatedonnxscript/ir/passes/common/shape_inference_test.py
to demonstrate usage.I added an optional reference to the graph from
Tape
. When the graph is specified, the added nodes are appended to the graph. This provides users the ability to examine the graph as they build it up using Tape.