You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge the two contributing docs and create instructions for updating an op (onnx#5584)
### Description
Merge the two contributing docs and create instructions for updating an
op
### Motivation and Context
Fixesonnx#5379
---------
Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: G. Ramalingam <[email protected]>
ONNX is a community project and we welcome your contributions! In addition to contributing code, you can also contribute in many other ways:
10
10
11
-
* Meetings and Discussions
12
-
Join SIGS, Working Groups, Community meetings to learn about what is needed and then where there is a good fit to interest and areas of expertise, find ways to actively contribute. Participate in [ONNX technical discussions](https://github.com/onnx/onnx/discussions) on GitHub. Join the ONNX Slack channels at LF AI and Data, help answer questions and welcome new members.
11
+
- Meetings and Discussions
13
12
14
-
* Use Cases and Tools
15
-
Develop use cases for ONNX and advocate for ONNX in developer conferences and meetups. Develop tools that import and export using the ONNX spec, and help grow the community of ONNX users. Become a champion for ONNX in your company or organization.
13
+
Join SIGS, Working Groups, Community meetings to learn about what is needed and then where there is a good fit to interest and areas of expertise, find ways to actively contribute. Participate in [ONNX technical discussions](https://github.com/onnx/onnx/discussions) on GitHub. Join the ONNX Slack channels at LF AI and Data, help answer questions and welcome new members.
16
14
17
-
* Roadmap and Features
18
-
Understand the ONNX roadmap document, feature priorities, and help implement them. Become an ONNX code and documentation contributor, and work towards committer status on important repos.
15
+
- Use Cases and Tools
19
16
20
-
* Releases and Model Zoo
21
-
Help in achieving a release of ONNX, including increasing the number of models in the ONNX Model Zoo that exercise ONNX features.
17
+
Develop use cases for ONNX and advocate for ONNX in developer conferences and meetups. Develop tools that import and export using the ONNX spec, and help grow the community of ONNX users. Become a champion for ONNX in your company or organization.
22
18
23
-
* Publications and Blogs
24
-
Add to the growing number of arXiv papers that refer to ONNX. Create blogs, presentations, books, articles and other materials that help increase the adoption of ONNX, and grow the community of users and contributors.
19
+
- Roadmap and Features
25
20
26
-
* Steering Committee
27
-
Attend ONNX Steering Committee meetings - they are open to all in the community. Help out where needed and appropriate on SC to-do items. Note that SIG and Working Groups leaders as well as others with demonstrated commitment and contributions to ONNX community may want to self-nominate during the annual SC election cycle.
21
+
Understand the ONNX roadmap document, feature priorities, and help implement them. Become an ONNX code and documentation contributor, and work towards committer status on important repos.
22
+
23
+
- Releases and Model Zoo
24
+
25
+
Help in achieving a release of ONNX, including increasing the number of models in the ONNX Model Zoo that exercise ONNX features.
26
+
27
+
- Publications and Blogs
28
+
29
+
Add to the growing number of arXiv papers that refer to ONNX. Create blogs, presentations, books, articles and other materials that help increase the adoption of ONNX, and grow the community of users and contributors.
30
+
31
+
- Steering Committee
32
+
33
+
Attend ONNX Steering Committee meetings - they are open to all in the community. Help out where needed and appropriate on SC to-do items. Note that SIG and Working Groups leaders as well as others with demonstrated commitment and contributions to ONNX community may want to self-nominate during the annual SC election cycle.
34
+
35
+
## Adding a new operator or creating a new version of an existing operator
36
+
37
+
ONNX is an open standard, and we encourage developers to contribute high
38
+
quality operators to ONNX specification.
39
+
40
+
Before proposing a new operator, please read [the tutorial](docs/AddNewOp.md).
28
41
29
42
## Contributing code
30
43
31
44
You can submit a pull request (PR) with your code. The [SIG](community/sigs.md) or [Working Group](community/working-groups.md) that is responsible for the area of the project your PR touches will review it and merge once any comments are addressed.
32
45
46
+
### Development
47
+
48
+
To build ONNX from source please follow the instructions listed [here](https://github.com/onnx/onnx#build-onnx-from-source).
49
+
50
+
Then, after you have made changes to Python and C++ files:
51
+
52
+
-`Python files`: The changes are effective immediately in your installation. You don't need to install these again.
53
+
-`C++ files`: You need to install these again to trigger the native extension build.
54
+
55
+
Assuming build succeed in the initial step, simply running
56
+
57
+
```sh
58
+
pip install -e .
59
+
```
60
+
61
+
from onnx root dir should work.
62
+
63
+
### Folder structure
64
+
65
+
-`onnx/`: the main folder that all code lies under
66
+
-`onnx.proto`: the protobuf that contains all the structures
67
+
-`checker.py`: a utility to check whether a serialized ONNX proto is legal
68
+
-`shape_inference.py`: a utility to infer types and shapes for ONNX models
69
+
-`version_converter.py`: a utility to upgrade or downgrade version for ONNX models
70
+
-`parser.py`: a utility to create an ONNX model or graph from a textual representation
71
+
-`hub.py`: a utility for downloading models from [ONNX Model Zoo](https://github.com/onnx/models)
72
+
-`compose.py`: a utility to merge ONNX models
73
+
-`helper.py`: tools for graph operation
74
+
-`defs/`: a subfolder that defines the ONNX operators
75
+
-`test/`: test files
76
+
77
+
### Generated operator documentation
78
+
79
+
Operator docs ([Operators.md](Operators.md), [Operators-ml.md](Operators-ml.md)) and Changelog docs ([Changelog.md](Changelog.md), [Changelog-ml.md](Changelog-ml.md)) are automatically generated based on C++ operator definitions and backend Python snippets. To refresh all these docs, run the following commands from the repo root and commit the results by setting "ONNX_ML=1". By contrast, setting `ONNX_ML=0` will only update `Operators.md` and `Changelog.md`.
80
+
81
+
```pwsh
82
+
# Windows
83
+
set ONNX_ML=1
84
+
```
85
+
86
+
```sh
87
+
# UNIX
88
+
export ONNX_ML=1
89
+
pip install -e .
90
+
python onnx/defs/gen_doc.py
91
+
```
92
+
93
+
### Coding style
94
+
95
+
We use `lintrunner` to drive multiple linters defined in `.lintrunner.toml` to lint the codebase.
96
+
97
+
To run these checks locally, install `lintrunner` and the linters with
98
+
99
+
```sh
100
+
pip install lintrunner lintrunner-adapters
101
+
lintrunner init
102
+
```
103
+
104
+
Then lint with
105
+
106
+
```sh
107
+
lintrunner
108
+
```
109
+
110
+
format with
111
+
112
+
```sh
113
+
# Display all lints and apply the fixes
114
+
lintrunner -a
115
+
# Or apply fixes only (faster)
116
+
lintrunner f
117
+
```
118
+
119
+
Run `lintrunner --help` and see the `.lintrunner.toml` file for more usage examples, as well as instructions on how to adopt new linters.
120
+
121
+
### Testing
122
+
123
+
ONNX uses [pytest](https://docs.pytest.org) as a test driver. To run tests, you'll first need to install pytest:
124
+
125
+
```sh
126
+
pip install pytest nbval
127
+
```
128
+
129
+
After installing pytest, run from the root of the repo:
130
+
131
+
```sh
132
+
pytest
133
+
```
134
+
135
+
to run the tests.
136
+
137
+
<!-- TODO(justinchuby): Get rid of the need for manually running stat_coverage -->
138
+
139
+
You'll need to regenerate test coverage too, by running this command from the root of the repo:
140
+
141
+
```sh
142
+
python onnx/backend/test/stat_coverage.py
143
+
```
144
+
145
+
#### Cpp tests (googletest)
146
+
147
+
Some functionalities are tested with googletest. Those tests are listed in `test/cpp`, and include tests for shape inference, data propagation, parser, and others.
148
+
149
+
To run them, first build ONNX with `-DONNX_BUILD_TESTS=1` or `ONNX_BUILD_TESTS=1 pip install -e .`.
150
+
151
+
##### Linux and MacOS
152
+
153
+
The cpp tests require dynamically linking to built libraries.
# If you set DEBUG=1, use `.setuptools-cmake-build\Debug\onnx_gtests.exe` instead
164
+
.setuptools-cmake-build\Release\onnx_gtests.exe
165
+
```
166
+
33
167
### DCO
168
+
34
169
ONNX has adopted the [DCO](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin). All code repositories under ONNX require a DCO. (ONNX previously used a CLA, which is being replaced with the DCO.)
35
170
36
171
DCO is provided by including a sign-off-by line in commit messages. Using the `-s` flag for `git commit` will automatically append this line. For example, running `git commit -s -m 'commit info.'` it will produce a commit that has the message `commit info. Signed-off-by: My Name <my_email@my_company.com>`. The DCO bot will ensure commits are signed with an email address that matches the commit author before they are eligible to be merged.
@@ -50,3 +185,20 @@ git checkout -b original_patch # create a new branch with the same
50
185
git commit -m 'type your own commit msg' -s # signoff that single commit
51
186
git push origin original_patch -f # forcibly override the old branch`
52
187
```
188
+
189
+
## CI Pipelines
190
+
191
+
Every PR needs to pass CIs before merge. CI pipelines details are [here](docs/CIPipelines.md).
192
+
193
+
## Other developer documentation
194
+
195
+
-[How to implement ONNX backend (ONNX to something converter)](docs/ImplementingAnOnnxBackend.md)
196
+
-[Backend test infrastructure and how to add tests](docs/OnnxBackendTest.md)
197
+
198
+
## License
199
+
200
+
[Apache License v2.0](/LICENSE)
201
+
202
+
## Code of Conduct
203
+
204
+
[ONNX Open Source Code of Conduct](http://onnx.ai/codeofconduct.html)
Copy file name to clipboardexpand all lines: README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ ONNX is [widely supported](http://onnx.ai/supported-tools) and can be found in m
45
45
46
46
ONNX is a community project and the open governance model is described [here](community/readme.md). We encourage you to join the effort and contribute feedback, ideas, and code. You can participate in the [Special Interest Groups](community/sigs.md) and [Working Groups](community/working-groups.md) to shape the future of ONNX.
47
47
48
-
Check out our [contribution guide](docs/CONTRIBUTING.md) to get started.
48
+
Check out our [contribution guide](/CONTRIBUTING.md) to get started.
49
49
50
50
If you think some operator should be added to ONNX specification, please read
51
51
[this document](docs/AddNewOp.md).
@@ -321,7 +321,7 @@ pytest
321
321
322
322
# Development
323
323
324
-
Check out the [contributor guide](docs/CONTRIBUTING.md) for instructions.
324
+
Check out the [contributor guide](/CONTRIBUTING.md) for instructions.
Or updating an existing operator to a new Opset version.
10
+
9
11
## Table of Contents
10
12
11
13
-[Adding New Operator or Function to ONNX](#adding-new-operator-or-function-to-onnx)
12
14
-[Table of Contents](#table-of-contents)
13
-
-[Proposing and submitting a new operator or function to ONNX](#proposing-and-submitting-a-new-operator-or-function-to-onnx-)
14
-
-[4 steps to add an operator](#4-steps-to-add-an-operator-)
15
-
-[Step 1: Proposing a new operator/function](#step-1-proposing-a-new-operatorfunction-)
16
-
-[Step 2: Submit PR](#step-2-submit-pr-)
15
+
-[Proposing and submitting a new operator or function to ONNX](#proposing-and-submitting-a-new-operator-or-function-to-onnx)
16
+
-[4 steps to add an operator](#4-steps-to-add-an-operator)
17
+
-[Step 1: Proposing a new operator/function](#step-1-proposing-a-new-operatorfunction)
18
+
-[Step 2: Submit PR](#step-2-submit-pr)
17
19
-[Example to Follow](#example-to-follow)
18
-
-[Step 3: PR Review by Operators SIG](#step-3-pr-review-by-operators-sig-)
20
+
-[Step 3: PR Review by Operators SIG](#step-3-pr-review-by-operators-sig)
19
21
-[Sign-off](#sign-off)
20
-
-[Step 4: ONNX release ](#step-4-onnx-release-)
21
-
-[Removing operator or function ](#removing-operator-or-function-)
22
-
-[Removing operator ](#removing-operator-)
23
-
-[Removing function ](#removing-function-)
24
-
-[Document removing operator or function ](#document-removing-operator-or-function-)
22
+
-[Step 4: ONNX release](#step-4-onnx-release)
23
+
-[Updating an existing operator](#updating-an-existing-operator)
24
+
-[Checklist](#checklist)
25
+
-[Removing operator or function](#removing-operator-or-function)
26
+
-[Removing operator](#removing-operator)
27
+
-[Removing function](#removing-function)
28
+
-[Document removing operator or function](#document-removing-operator-or-function)
25
29
26
-
## Proposing and submitting a new operator or function to ONNX <aname="new_operator_or_function"></a>
30
+
## Proposing and submitting a new operator or function to ONNX
27
31
28
32
Operators are the basic building blocks used to define ONNX models. With a rich set of operators, ONNX can describe most DNN and ML models from various frameworks. Functions enable expressing complex operators in terms of more primitive operators. The ONNX specification includes a core set of operators that enable many models. It is a non-goal to add all possible operators, however more operators are added as needed to cover evolving needs.
29
33
30
34
In this document, we describe the process of accepting a new proposed operator and how to properly submit a new operator as part of ONNX standard. The goal is to improve on what we currently have based on our experience, learning and feedbacks we gathered from the community.
31
35
32
-
## 4 steps to add an operator <aname="steps_to_add_an_operator"></a>
36
+
## 4 steps to add an operator
33
37
34
38
1. Decide what to propose
35
39
2. Submit PR for new operator/function
36
40
3. Review of PR by Operators SIG
37
41
4. Merging of PR and inclusion in next ONNX release
38
42
39
-
### Step 1: Proposing a new operator/function <aname="step1_new_operator_or_function"></a>
43
+
### Step 1: Proposing a new operator/function
40
44
41
45
In order to propose a new operator/function, the following is needed:
42
46
@@ -54,7 +58,7 @@ This requires carefully balancing generality and complexity. For example, genera
54
58
N-D tensors is straight-forward (implementation-wise) for some operators, but complex for other operators.
55
59
The choice in such cases will be made based on the complexity of such a generalization.
Once the criteria of proposing new operator/function has been satisfied, you will need to submit a PR for the new operator/function. Here the expectation of what the PR should include. The reviewer is expected to verify the completeness of the PR before signoff.
60
64
@@ -85,21 +89,31 @@ rank inference at the very least (adding right amount of dimensions to the outpu
85
89
86
90
[PR 1959](https://github.com/onnx/onnx/pull/1959) is a good example to follow.
87
91
88
-
### Step 3: PR Review by Operators SIG <aname="step3_new_operator_or_function"></a>
92
+
### Step 3: PR Review by Operators SIG
89
93
90
94
The [Operators SIG](https://github.com/onnx/sigs/tree/main/operators) is responsible for the operators/functions in the ONNX specification. The SIG regularly meets and reviews PRs.
91
95
92
96
#### Sign-off
93
97
94
98
At least two sign-off from the Operators SIG [contributors](https://github.com/onnx/onnx/tree/main/community#community-roles).
Once the PR is reviewed and signed off by the Operators SIG, it will be merged. Your new operator/function will be part of the main branch and available to anyone building from source. These are not official releases. ONNX periodically releases official new versions that are a snapshot of the main branch. Your new operator/function will be part of that release.
98
103
99
-
## Removing operator or function <aname="removing_operator_or_function"></a>
104
+
## Updating an existing operator
105
+
106
+
The definition of an existing operator may need to be updated when e.g. there are new scenarios or input types to support. The process is largely similar to that for creating a new operator.
107
+
108
+
### Checklist
109
+
110
+
Use this checklist when updating an existing operator: https://github.com/onnx/onnx/wiki/Checklist-for-updating-an-existing-operator
111
+
112
+
## Removing operator or function
113
+
100
114
There are a lot of reasons for removing existing ONNX operator or function, such us being replaced with different operator or can be decomposed by a set of other operators. This document describes the criteria of removing an existing ONNX operator from the standard.
Any operator in ONNX was added because it was required by a model and/or framework. In order to deprecate such an operator we need to do the following.
105
119
@@ -111,11 +125,11 @@ Any operator in ONNX was added because it was required by a model and/or framewo
111
125
- Add a version adapter which turns the operator into its replacement for the version converter. Example: [onnx/version_converter/adapters/upsample_9_10.h](/onnx/version_converter/adapters/upsample_9_10.h)
112
126
- No grace period is needed for deprecated operators.
113
127
114
-
### Removing function <aname="removing_function"></a>
128
+
### Removing function
115
129
116
-
Function, by definition, is composed of ONNX primitives; however, function could have been accelerated by framework or runtime that support ONNX. So, removing function is not recommended, with the exception of adding another single function which supersede its functionality.
130
+
Function, by definition, is composed of ONNX primitives; however, function could have been accelerated by framework or runtime that support ONNX. So, removing function is not recommended, with the exception of adding another single function which supersedes its functionality.
117
131
118
-
### Document removing operator or function <aname="document_removing_operator_or_function"></a>
132
+
### Document removing operator or function
119
133
120
134
To make sure everyone is aware of the deprecation, the following need to happen:
0 commit comments