Skip to content

Improvement to IR docs 2/n #2229

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

Merged
merged 13 commits into from
Apr 25, 2025
Merged

Improvement to IR docs 2/n #2229

merged 13 commits into from
Apr 25, 2025

Conversation

justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Apr 25, 2025

Major improvement in documenting all submodules in onnxscript.ir. Also added documentation for the rewriter, optimizer and version converter.

image

image

Copy link

codecov bot commented Apr 25, 2025

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
13861 5 13856 2338
View the top 3 failed test(s) by shortest run time
onnxscript.backend.onnx_export_test.TestOnnxBackEnd::test_export2python_produces_correct_onnx_script_model_0047_test_argmax_negative_axis_keepdims_random_select_last_index
Stack Traces | 0.003s run time
onnxscript\backend\onnx_export_test.py:137: in extract_functions
    mod = importlib.import_module(import_name)
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'tests.onnx_backend_test_code.test_argmax_negative_axis_keepdims_random_select_last_index'

The above exception was the direct cause of the following exception:
.nox\test_torch_nightly\Lib\site-packages\parameterized\parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
onnxscript\backend\onnx_export_test.py:271: in test_export2python_produces_correct_onnx_script_model
    functions = extract_functions(backend_test.name, code, self.test_folder)
onnxscript\backend\onnx_export_test.py:139: in extract_functions
    raise AssertionError(
E   AssertionError: Unable to import 'tests.onnx_backend_test_code.test_argmax_negative_axis_keepdims_random_select_last_index' (e=No module named 'tests.onnx_backend_test_code.test_argmax_negative_axis_keepdims_random_select_last_index') (file: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_argmax_negative_axis_keepdims_random_select_last_index.py', absolute path: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_argmax_negative_axis_keepdims_random_select_last_index.py', current folder: D:\a\onnxscript\onnxscript
E   ---- CONTENT --
E   import numpy
E   from onnx import TensorProto
E   from onnx.helper import make_tensor
E   from onnxscript import script, external_tensor
E   from onnxscript.values import Opset
E   from onnxscript.onnx_types import FLOAT, INT64
E   from onnxscript.onnx_opset import opset13
E   
E   @script()
E   def bck_test_argmax_negative_axis_keepdims_random_select_last_index(data: FLOAT[2,3,4]) -> (INT64[2,3,1]):
E       result = opset13.ArgMax(data, axis=-1, keepdims=1, select_last_index=1)
E       return result
onnxscript.backend.onnx_export_test.TestOnnxBackEnd::test_export2python_produces_correct_onnx_script_model_0874_test_prelu_broadcast
Stack Traces | 0.003s run time
onnxscript\backend\onnx_export_test.py:137: in extract_functions
    mod = importlib.import_module(import_name)
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'tests.onnx_backend_test_code.test_prelu_broadcast'

The above exception was the direct cause of the following exception:
.nox\test_torch_nightly\Lib\site-packages\parameterized\parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
onnxscript\backend\onnx_export_test.py:271: in test_export2python_produces_correct_onnx_script_model
    functions = extract_functions(backend_test.name, code, self.test_folder)
onnxscript\backend\onnx_export_test.py:139: in extract_functions
    raise AssertionError(
E   AssertionError: Unable to import 'tests.onnx_backend_test_code.test_prelu_broadcast' (e=No module named 'tests.onnx_backend_test_code.test_prelu_broadcast') (file: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_prelu_broadcast.py', absolute path: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_prelu_broadcast.py', current folder: D:\a\onnxscript\onnxscript
E   ---- CONTENT --
E   import numpy
E   from onnx import TensorProto
E   from onnx.helper import make_tensor
E   from onnxscript import script, external_tensor
E   from onnxscript.values import Opset
E   from onnxscript.onnx_types import FLOAT
E   from onnxscript.onnx_opset import opset16
E   
E   @script()
E   def bck_test_prelu_broadcast(x: FLOAT[3,4,5], slope: FLOAT[5]) -> (FLOAT[3,4,5]):
E       y = opset16.PRelu(x, slope)
E       return y
onnxscript.backend.onnx_export_test.TestOnnxBackEnd::test_export2python_produces_correct_onnx_script_model_1297_test_softmax_default_axis
Stack Traces | 0.004s run time
onnxscript\backend\onnx_export_test.py:137: in extract_functions
    mod = importlib.import_module(import_name)
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'tests.onnx_backend_test_code.test_softmax_default_axis'

The above exception was the direct cause of the following exception:
.nox\test_onnx_weekly\Lib\site-packages\parameterized\parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
onnxscript\backend\onnx_export_test.py:271: in test_export2python_produces_correct_onnx_script_model
    functions = extract_functions(backend_test.name, code, self.test_folder)
onnxscript\backend\onnx_export_test.py:139: in extract_functions
    raise AssertionError(
E   AssertionError: Unable to import 'tests.onnx_backend_test_code.test_softmax_default_axis' (e=No module named 'tests.onnx_backend_test_code.test_softmax_default_axis') (file: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_softmax_default_axis.py', absolute path: 'D:\\a\\onnxscript\\onnxscript\\tests\\onnx_backend_test_code\\test_softmax_default_axis.py', current folder: D:\a\onnxscript\onnxscript
E   ---- CONTENT --
E   import numpy
E   from onnx import TensorProto
E   from onnx.helper import make_tensor
E   from onnxscript import script, external_tensor
E   from onnxscript.values import Opset
E   from onnxscript.onnx_types import FLOAT
E   from onnxscript.onnx_opset import opset13
E   
E   @script()
E   def bck_test_softmax_default_axis(x: FLOAT[3,4,5]) -> (FLOAT[3,4,5]):
E       y = opset13.Softmax(x)
E       return y

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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 documentation for the IR submodules and related API components by adding detailed pages for traversal, tape, passes, external data, convenience functions, core IR constructs, and model transformation utilities.

  • Added new documentation pages for ir.traversal, ir.tape, ir.passes_common, ir.passes, ir.external_data, ir.convenience, and core IR functions and classes.
  • Updated the documentation structure by revising index pages for IR APIs and the overall docs, and added new API pages for version_converter, rewriter, and optimizer while removing the obsolete tools page.

Reviewed Changes

Copilot reviewed 24 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
docs/ir/ir_api/ir_traversal.md Added page for IR traversal API documentation
docs/ir/ir_api/ir_tape.md Added page for IR tape API documentation
docs/ir/ir_api/ir_passes_common.md Added page for common IR passes and utilities
docs/ir/ir_api/ir_passes.md Added page for IR passes including pass infrastructure
docs/ir/ir_api/ir_external_data.md Added page for external data handling in IR
docs/ir/ir_api/ir_convenience.md Added page for IR convenience helper functions
docs/ir/ir_api/index.md Updated index for IR API documentation
docs/ir/core.md Updated the core IR documentation splitting functions and classes
docs/ir/index.md Revised IR index to use new IR API structure
docs/index.md Updated main docs index to reference new IR documentation
docs/api/version_converter.md Added documentation for version converter API
docs/api/tools.md Removed obsolete tools documentation page
docs/api/rewriter.md Added documentation for rewriter API
docs/api/optimizer.md Added documentation for optimizer API
docs/api/index.md Updated API index to reflect reorganized sections
Files not reviewed (3)
  • docs/_templates/classtemplate.rst: Language not supported
  • docs/_templates/classtemplate_inherited.rst: Language not supported
  • docs/_templates/functiontemplate.rst: Language not supported
Comments suppressed due to low confidence (2)

docs/ir/ir_api/ir_external_data.md:20

  • [nitpick] Consider adding concrete usage examples for the onnxscript.external_data functions to further improve the clarity and usefulness of the documentation.
<!-- TODO: Create examples -->

docs/api/tools.md:1

  • Verify that the removal of the docs/api/tools.md file does not break any navigation links or references in the documentation index files.
# Tools

@justinchuby justinchuby added the topic: documentation Improvements or additions to documentation label Apr 25, 2025
@justinchuby justinchuby enabled auto-merge (squash) April 25, 2025 21:43
@justinchuby justinchuby merged commit decab2e into main Apr 25, 2025
23 of 29 checks passed
@justinchuby justinchuby deleted the justinchu/docs-2 branch April 25, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation Improvements or additions to documentation
Projects
Development

Successfully merging this pull request may close these issues.

2 participants