Add input() and add_output() methods to GraphBuilder#2828
Conversation
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request enhances the GraphBuilder class by adding two new convenience methods for managing graph inputs and outputs. The changes simplify the process of creating graph inputs with rich metadata and adding outputs with optional renaming, improving the ergonomics of the graph-building API.
Changes:
- Added
input()method toGraphBuilderfor creating and registering graph input values with support for dtype, shape, type, const_value, and metadata properties - Added
add_output()method toGraphBuilderfor appending output values to the graph with optional renaming - Added comprehensive unit tests for both new methods, plus additional test coverage for the existing
initializer()method's qualification behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
onnxscript/_internal/builder.py |
Implements the new input() and add_output() methods on the GraphBuilder class with full parameter support and documentation |
onnxscript/_internal/builder_test.py |
Adds three new test methods covering the behavior of input(), add_output(), and initializer() qualification |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2828 +/- ##
==========================================
+ Coverage 71.78% 71.83% +0.05%
==========================================
Files 239 239
Lines 28989 29043 +54
Branches 2859 2861 +2
==========================================
+ Hits 20809 20864 +55
+ Misses 7209 7208 -1
Partials 971 971 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
This pull request adds new methods to the `GraphBuilder` class to simplify the creation and management of graph inputs and outputs, and introduces corresponding unit tests to ensure their correct behavior. The changes improve the usability and reliability of the graph-building API. **Enhancements to the GraphBuilder API:** * Added a new `input` method to `GraphBuilder` for creating and registering graph input values with support for specifying name, dtype, shape, type, constant value, and metadata properties. * Added a new `add_output` method to `GraphBuilder` to append an output value to the graph and optionally rename it. --------- Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
This pull request adds new methods to the
GraphBuilderclass to simplify the creation and management of graph inputs and outputs, and introduces corresponding unit tests to ensure their correct behavior. The changes improve the usability and reliability of the graph-building API.Enhancements to the GraphBuilder API:
inputmethod toGraphBuilderfor creating and registering graph input values with support for specifying name, dtype, shape, type, constant value, and metadata properties.add_outputmethod toGraphBuilderto append an output value to the graph and optionally rename it.