From ccdedf1b2e0dca5e64eb0016efccaef2d6922bae Mon Sep 17 00:00:00 2001 From: Yulong Wang Date: Thu, 27 May 2021 14:51:57 -0700 Subject: [PATCH] [js] update documents (#7852) * [js] update documents * escape double quotes * update operators.md * resolve comments --- js/README.md | 177 +++++++++++++++--- js/web/README.md | 42 ++--- js/web/docs/operators.md | 174 +++++++++++++++++ js/web/package.json | 1 + js/web/script/generate-operator-md.ts | 105 +++++++++++ .../azure-pipelines/win-wasm-ci-pipeline.yml | 10 +- 6 files changed, 451 insertions(+), 58 deletions(-) create mode 100644 js/web/docs/operators.md create mode 100644 js/web/script/generate-operator-md.ts diff --git a/js/README.md b/js/README.md index cbc7fb588f..177cba8b1e 100644 --- a/js/README.md +++ b/js/README.md @@ -7,7 +7,7 @@ This directory contains multiple NPM projects: - [onnxruntime-web](#onnxruntime-web) - [onnxruntime-react-native](#onnxruntime-react-native) -### Development +## Development This folder contains a `.vscode` folder for Visual Studio Code workspace configs. Using VSCode to open this folder will allow code-formatting and linting features on typescript and C/C++ source code inside this folder. Following files @@ -19,20 +19,45 @@ are used for code-formatting and linting features for developers: - .eslintrc.js - .clang-format -#### Using VSCode: +Please follow the steps described below to setup development environment. -1. in `/js`, run: - > npm ci -2. use VSCode to open folder `/js` -3. install VSCode extension if not installed yet: - - Clang-Format - - ESLint +### Prerequisites -To populate typescript type declarations, in each projects, run `npm ci`. +- Node.js (14.0+): https://nodejs.org/ - (Optional) Use nvm ([Windows](https://github.com/coreybutler/nvm-windows) / [Mac/Linux](https://github.com/creationix/nvm)) to install Node.js -#### Run code formatter and linter manually +- Python (2.7 or 3.6+): https://www.python.org/downloads/ -in `/js`, use `npm run lint` to run ESLint , and use `npm run format` to run clang-format. + - python should be added to the PATH environment variable + +- Visual Studio Code: https://code.visualstudio.com/ + + - **required** extension: [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + - **required** extension: [Clang-Format](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format) + - **required** extension: [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) + +- Chrome or Edge Browser + +### Setup TypeScript development environment + +In `/js`, run: + +``` +npm ci +``` + +This will install Clang-format and ESLint for code-formatting and linting features. This is a one-time setup unless a `git clean` is performed or folder `/js/node_modules` is removed manually. + +### Using VSCode: + +Use VSCode to open folder `/js`. + +Make sure to open the correct folder to allow VSCode to load workspace configuration. Otherwise typescript and code formatter may not work as expected. + +To populate typescript type declarations, in each project folder, run `npm ci`. + +### Run code formatter and linter manually + +In `/js`, use `npm run lint` to run ESLint , and use `npm run format` to run clang-format. ## onnxruntime-common @@ -112,10 +137,6 @@ It should be able to consumed by from projects that uses NPM packages (through a This project is a library for running ONNX models on browsers. It is the successor of [ONNX.js](https://github.com/Microsoft/onnxjs). -### Requirements - -Node.js v12+ (recommended v14+) - ### Build 1. Install NPM packages @@ -124,9 +145,9 @@ Node.js v12+ (recommended v14+) 2. in `/js/common/`, run `npm ci`. 3. in `/js/web/`, run `npm ci`. -2. ~~Follow [instructions](https://www.onnxruntime.ai/docs/how-to/build.html#apis-and-language-bindings) for building ONNX Runtime WebAssembly. (TODO: document is not ready. we are working on it.)~~ +2. ~~Follow [instructions](https://www.onnxruntime.ai/docs/how-to/build.html#apis-and-language-bindings) for building ONNX Runtime WebAssembly. (TODO: document is not ready. we are working on it. Please see steps described as below.)~~ - in `/`, run either of the following commands to build WebAssembly: + in `/`, run one of the following commands to build WebAssembly: ```sh # In windows, use 'build' to replace './build.sh' @@ -134,11 +155,16 @@ Node.js v12+ (recommended v14+) # The following command build debug. ./build.sh --build_wasm + # The following command build debug with debug info. + ./build.sh --build_wasm --skip_tests --enable_wasm_debug_info + # The following command build release. ./build.sh --config Release --build_wasm --skip_tests --disable_wasm_exception_catching --disable_rtti ``` - To build with multi-thread support, append flag ` --enable_wasm_threads` to the command. Make sure to build both single-thread and multi-thread before next step. + To build with multi-thread support, append flag `--enable_wasm_threads` to the command. Make sure to build both single-thread and multi-thread before next step. + + NOTE: You can also find latest build artifacts on [Windows WebAssembly CI Pipeline](https://dev.azure.com/onnxruntime/onnxruntime/_build?definitionId=161&_a=summary&repositoryFilter=1&branchFilter=4%2C4%2C4%2C4%2C4%2C4). Choose any build for master branch, download artifacts "Release_ort-wasm" and "Release_ort-wasm-threaded" and unzip. 3. Copy following files from build output folder to `/js/web/dist/`: @@ -156,9 +182,91 @@ Node.js v12+ (recommended v14+) npm run build ``` +### Test + +We use command `npm test` (test runner) and `npm run test:e2e` (E2E test) for tests in ONNXRuntime Web. + +#### test runner + +In folder `/js/web`, + +- Run `npm test -- --help` for a full CLI instruction. +- Run `npm test -- --debug` to run one or more test cases. + +There are multiple levels of tests for ONNXRuntime Web: + +- unit test: tests for individual components written in TypeScript. Launch unit test by: + ``` + npm test -- unittest + ``` +- model test: run a single model. The model folder should contains one .onnx model file and one or more folders for test cases, each folder contains several input*\*.pb and output*\*.pb as test data. Launch model test by: + ``` + npm test -- model + ``` +- op test: test a single operator. An op test is described in a `.jsonc` file which specify the operator type, its attributes and one or more test case(s), each includes a list of expected input tensor(s) and output tensor(s). The `.jsonc` file is located at `/js/web/test/data/ops`. Launch op test by: + + ``` + npm test -- op + ``` + +- suite test: suite test includes unit test, a list of model tests and op tests. Launch suite test by: + ``` + npm test + ``` + +#### E2E test + +E2E test is for testing end-to-end package consuming. In this test, NPM packages for `onnxruntime-common` and `onnxruntime-web` are generated and a clean folder is used for installing packages. Then a simple mocha test is performed to make sure package can be consumed correctly. + +To launch E2E test: + +``` +npm run test:e2e +``` + +### Debugging + +#### Debugging TypeScript on Desktop/Chrome + +To debug the code from test-runner on Chrome: + +- Launch `npm test -- --debug`. It opens an instance of Chrome browser. +- In the open Chrome browser, click the `DEBUG` button on the top-right of the page. +- In VSCode, click [side bar]->Run and Debug->select [Attach to Chrome]->click [Start Debugging] to attach. +- put breakpoints in source code, and Refresh the page to reload. + +#### Debugging TypeScript on iOS/Safari + +To debug on an Apple iOS device, please refer to the following steps: + +- install [ + RemoteDebug iOS WebKit Adapter](https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter) by following its instructions. +- launch the adapter in commandline: `remotedebug_ios_webkit_adapter --port=9000`. +- in VSCode, select debug configuration `Remote Browser via Webkit Adaptor`. +- follow the steps above to debug. + +#### Debugging TypeScript on Android/Chrome + +To debug on an Android device, please refer to the following steps: + +- Install [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) and make sure `adb` is ready to use. +- Follow instructions in [Remote Debugging on Android](https://developer.chrome.com/devtools/docs/remote-debugging-legacy) to launch `adb`. Make sure to use port 9000 so that the existing debug configuration works. +- in VSCode, select debug configuration `Remote Browser via Webkit Adaptor`. +- follow the steps above to debug. + +#### Debugging C/C++ for ONNX Runtime WebAssembly + +To debug C/C++ code for ONNX Runtime WebAssembly, you need to build ONNX Runtime with debug info (see [Build](#Build-2)). + +Currently debugging C/C++ code in WebAssembly is not supported in VSCode yet. Please follow [this instruction](https://developer.chrome.com/blog/wasm-debugging-2020/) to debug in browser devtool using extension [C/C++ DevTools Support (DWARF)](https://chrome.google.com/webstore/detail/cc%20%20-devtools-support-dwa/pdcpmagijalfljmkmjngeonclgbbannb). + +### Generating Document + +Use command `npm run build:doc` to generate the latest documents. + ### Distribution -It should be able to consumed by both from projects that uses NPM packages (through a Node.js folder structure of `node_modules` folder that generated by `npm install onnxruntime-web`) and from a CDN service that serves a `.min.js` file and one or multiple `.wasm` file(s). +It should be able to consumed by both from projects that uses NPM packages (through a Node.js folder structure of `node_modules` folder that generated by `npm install onnxruntime-web`) and from a CDN service that serves a `ort.min.js` file and one or multiple `.wasm` file(s). ## onnxruntime-react-native @@ -192,6 +300,7 @@ This project provides an ONNX Runtime React Native JavaScript library to run ONN 1. Set up an Android build environment referring to [instruction](https://www.onnxruntime.ai/docs/how-to/build.html#android) 2. In ``, run this python script to build ONNX Runtime Android archive file. In windows, this requires admin account to build. If an app uses a fixed set of models, refer to [instruction](https://www.onnxruntime.ai/docs/how-to/build.html#android) and build a mobile version package + ```python python tools/ci_build/github/android/build_aar_package.py js/react_native/scripts/aar_build_settings.json --config MinSizeRel --android_sdk_path --android_ndk_path --build_dir ``` @@ -199,6 +308,7 @@ This project provides an ONNX Runtime React Native JavaScript library to run ONN 3. This generates `onnxruntime-mobile-.aar` in `/aar_out/MinSizeRel/com/microsoft/onnxruntime/onnxruntime-mobile/`. Copy `aar` file into `/js/react_native/android/libs` and rename it as `onnxruntime.aar` 4. To verify, open Android Emulator and run this command from `/js/react_native/android` + ```sh adb shell am instrument -w ai.onnxruntime.react_native.test/androidx.test.runner.AndroidJUnitRunner ``` @@ -206,40 +316,45 @@ This project provides an ONNX Runtime React Native JavaScript library to run ONN 3. Build iOS ONNX Runtime package 1. Set up iOS build environment referring to [instruction](https://www.onnxruntime.ai/docs/how-to/build.html#ios). - + 2. Build ONNX Runtime library for iOS from `` using this command, + ```sh ./build.sh --config MinSizeRel --use_xcode --ios --ios_sysroot iphoneos --osx_arch arm64 --apple_deploy_target 11 ``` + Copy `/build/iOS/MinSizeRel/MinSizeRel-iphoneos/libonnxruntime..dylib` file into `/js/react_native/ios/Libraries/onnxruntime/lib/iphoneos` 3. Clean up the previous build and build ONNX Runtime library for iOS Simulator from `` + ```sh ./build.sh --config MinSizeRel --use_xcode --ios --ios_sysroot iphonesimulator --osx_arch x86_64 --apple_deploy_target 11 ``` + Copy `/build/iOS/MinSizeRel/MinSizeRel-iphonesimulator/libonnxruntime..dylib` file into `/js/react_native/ios/Libraries/onnxruntime/lib/iphonesimulator` - + 4. Edit `onnxruntime-react-native.iphoneos.podspec` and `onnxruntime-react-native.iphonesimulator.podsepc` in `/js/react_native` to change a version of ONNX Runtime library. 5. Copy ONNX Runtime header files + ```sh cp /include/onnxruntime/core/session/*.h /js/react_native/ios/Libraries/onnxruntime/include ``` 6. To verify, open iOS Simulator and run this command from `/js/react_native/ios`. Change a destination to specify a running iOS Simulator. - ```sh - pod install - export ONNXRUNTIME_VERSION=; xcodebuild test -workspace OnnxruntimeModule.xcworkspace -scheme OnnxruntimeModuleTest -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.5' - ``` + ```sh + pod install + export ONNXRUNTIME_VERSION=; xcodebuild test -workspace OnnxruntimeModule.xcworkspace -scheme OnnxruntimeModuleTest -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.5' + ``` 4. Update a version in `package.json` to align with ONNX Runtime version. 5. Test an example for Android and iOS. In Windows, open Android Emulator first. From `/js/react_native` - ```sh - yarn bootstrap - yarn example ios - yarn example android - ``` + ```sh + yarn bootstrap + yarn example ios + yarn example android + ``` ### NPM Packaging @@ -251,7 +366,7 @@ This project provides an ONNX Runtime React Native JavaScript library to run ONN 4. Run `npm publish --dry-run` to see how it's going to be published -5. Run `npm publish ` to publish to npmjs +5. Run `npm publish ` to publish to npmjs. If it's for a dev, add flag `--tag dev`. ### Distribution diff --git a/js/web/README.md b/js/web/README.md index a59c84db11..731f87cbb2 100644 --- a/js/web/README.md +++ b/js/web/README.md @@ -6,7 +6,7 @@ ONNX Runtime Web has adopted WebAssembly and WebGL technologies for providing an ### Why ONNX models -The [Open Neural Network Exchange](http://onnx.ai/) (ONNX) is an open standard for representing machine learning models. The biggest advantage of ONNX is that it allows interoperability across different open source AI frameworks, which itself offers more flexibility for AI frameworks adoption. See [Getting ONNX Models](#Getting-ONNX-models). +The [Open Neural Network Exchange](http://onnx.ai/) (ONNX) is an open standard for representing machine learning models. The biggest advantage of ONNX is that it allows interoperability across different open source AI frameworks, which itself offers more flexibility for AI frameworks adoption. ### Why ONNX Runtime Web @@ -22,35 +22,25 @@ Refer to [ONNX Runtime JavaScript examples](https://github.com/microsoft/onnxrun ## Documents -### Developers +### Developement -Refer to [Using VSCode](../README.md#Using-VSCode) for setting up development environment. +Refer to the following links for development information: -For information about building ONNX Runtime Web development, please check [Build](../README.md#build-2). - -### Getting ONNX models - -You can get ONNX models easily in multiple ways: - -- Choose a pre-trained ONNX model from the [ONNX Model Zoo](https://github.com/onnx/models) -- Convert models from mainstream frameworks, e.g. PyTorch, TensorFlow and Keras, by following [ONNX tutorials](https://github.com/onnx/tutorials) -- Use your data to generate a customized ONNX model from [Azure Custom Vision service](https://docs.microsoft.com/en-us/azure/cognitive-services/Custom-Vision-Service/home) -- [Train a custom model in AzureML](https://github.com/Azure/MachineLearningNotebooks/tree/master/training) and save it in the ONNX format - -Learn more about ONNX - -- [ONNX website](http://onnx.ai/) -- [ONNX on GitHub](https://github.com/onnx/onnx) +- [Development](../README.md#Development) +- [Build](../README.md#Build-2) +- [Test](../README.md#Test) +- [Debugging](../README.md#Debugging) +- [Generating Document](../README.md#Generating-Document) ### Compatibility -| OS/Browser | Chrome | Edge | Safari | Electron | -| :--------------: | :----------------: | :----------------: | :----------------: | :----------------: | -| Windows 10 | :heavy_check_mark: | :heavy_check_mark: | - | :heavy_check_mark: | -| macOS | :heavy_check_mark: | - | :heavy_check_mark: | :heavy_check_mark: | -| Ubuntu LTS 18.04 | :heavy_check_mark: | - | - | :heavy_check_mark: | -| iOS | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | - | -| Android | :heavy_check_mark: | - | - | - | +| OS/Browser | Chrome | Edge | Safari | Electron | Node.js | +| :--------------: | :---------: | :---------: | :----: | :---------: | :-----: | +| Windows 10 | wasm, webgl | wasm, webgl | - | wasm, webgl | wasm | +| macOS | wasm | - | wasm | wasm | wasm | +| Ubuntu LTS 18.04 | wasm | - | - | wasm | wasm | +| iOS | wasm | wasm | wasm | - | - | +| Android | wasm | - | - | - | - | ### Operators @@ -60,7 +50,7 @@ ONNX Runtime Web currently support all operators in [ai.onnx](https://github.com #### WebGL backend -ONNX Runtime Web currently supports most operators in [ai.onnx](https://github.com/onnx/onnx/blob/rel-1.2.3/docs/Operators.md) operator set v7 (opset v7). See [operators.md](./docs/operators.md) for a complete, detailed list of which ONNX operators are supported by WebGL backend. +ONNX Runtime Web currently supports a subset of operators in [ai.onnx](https://github.com/onnx/onnx/blob/master/docs/Operators.md) operator set. See [operators.md](./docs/operators.md) for a complete, detailed list of which ONNX operators are supported by WebGL backend. ## License diff --git a/js/web/docs/operators.md b/js/web/docs/operators.md new file mode 100644 index 0000000000..212937df99 --- /dev/null +++ b/js/web/docs/operators.md @@ -0,0 +1,174 @@ +## Operators Support Table + +The following table shows [ai.onnx](https://github.com/onnx/onnx/blob/master/docs/Operators.md) operators from which onnx opset version are currently supported by onnxjs. For example, `4-6, 8+` means ONNX Runtime Web currently support opset version 4 to 6, 8 and above. + +See [Compatibility](../README.md#Compatibility) for a list of the supported platforms. + +*This file is automatically generated from the def files via [this script](../script/generate-operator-md.ts). Do not modify directly.* + +| Operator | WebGl Backend | +|:--------:|:-------------:| +| [Abs](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Abs) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Abs-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Abs-13) | +| [Acos](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Acos) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Acos-7) | +| [Acosh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Acosh) | | +| [Add](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Add) | [7-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Add-7), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Add-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Add-14) | +| [And](https://github.com/onnx/onnx/blob/master/docs/Operators.md#And) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#And-7) | +| [ArgMax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ArgMax) | | +| [ArgMin](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ArgMin) | | +| [Asin](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Asin) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Asin-7) | +| [Asinh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Asinh) | | +| [Atan](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Atan) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Atan-7) | +| [Atanh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Atanh) | | +| [AveragePool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#AveragePool) | [7-9](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#AveragePool-7), [10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#AveragePool-10) | +| [BatchNormalization](https://github.com/onnx/onnx/blob/master/docs/Operators.md#BatchNormalization) | [7-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#BatchNormalization-7), [9-13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#BatchNormalization-9), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#BatchNormalization-14) | +| [BitShift](https://github.com/onnx/onnx/blob/master/docs/Operators.md#BitShift) | | +| [Cast](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Cast) | | +| [Ceil](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Ceil) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Ceil-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Ceil-13) | +| [Celu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Celu) | | +| [Clip](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Clip) | [6-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Clip-6) | +| [Compress](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Compress) | | +| [Concat](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Concat) | [4-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Concat-4), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Concat-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Concat-13) | +| [ConcatFromSequence](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ConcatFromSequence) | | +| [Constant](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant) | | +| [ConstantOfShape](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ConstantOfShape) | | +| [Conv](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Conv) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Conv-1), [11+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Conv-11) | +| [ConvInteger](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ConvInteger) | | +| [ConvTranspose](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ConvTranspose) | | +| [Cos](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Cos) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Cos-7) | +| [Cosh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Cosh) | | +| [CumSum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#CumSum) | | +| [DepthToSpace](https://github.com/onnx/onnx/blob/master/docs/Operators.md#DepthToSpace) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#DepthToSpace-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#DepthToSpace-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#DepthToSpace-13) | +| [DequantizeLinear](https://github.com/onnx/onnx/blob/master/docs/Operators.md#DequantizeLinear) | | +| [Det](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Det) | | +| [Div](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Div) | [7-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Div-7), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Div-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Div-14) | +| [Dropout](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Dropout) | [7-9](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Dropout-7), [10-11](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Dropout-10), [12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Dropout-12), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Dropout-13) | +| [DynamicQuantizeLinear](https://github.com/onnx/onnx/blob/master/docs/Operators.md#DynamicQuantizeLinear) | | +| [Einsum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Einsum) | | +| [Elu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Elu) | [6+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Elu-6) | +| [Equal](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Equal) | [7-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Equal-7), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Equal-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Equal-13) | +| [Erf](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Erf) | | +| [Exp](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Exp) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Exp-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Exp-13) | +| [Expand](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Expand) | | +| [EyeLike](https://github.com/onnx/onnx/blob/master/docs/Operators.md#EyeLike) | | +| [Flatten](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Flatten) | [1-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Flatten-1), [9-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Flatten-9), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Flatten-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Flatten-13) | +| [Floor](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Floor) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Floor-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Floor-13) | +| [GRU](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GRU) | | +| [Gather](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Gather) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gather-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gather-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gather-13) | +| [GatherElements](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GatherElements) | | +| [GatherND](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GatherND) | | +| [Gemm](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Gemm) | [7-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gemm-7), [9-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gemm-9), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gemm-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Gemm-13) | +| [GlobalAveragePool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GlobalAveragePool) | [1+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#GlobalAveragePool-1) | +| [GlobalLpPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GlobalLpPool) | | +| [GlobalMaxPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GlobalMaxPool) | [1+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#GlobalMaxPool-1) | +| [Greater](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Greater) | [7-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Greater-7), [9-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Greater-9), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Greater-13) | +| [GreaterOrEqual](https://github.com/onnx/onnx/blob/master/docs/Operators.md#GreaterOrEqual) | | +| [HardSigmoid](https://github.com/onnx/onnx/blob/master/docs/Operators.md#HardSigmoid) | | +| [HardSwish](https://github.com/onnx/onnx/blob/master/docs/Operators.md#HardSwish) | | +| [Hardmax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Hardmax) | | +| [Identity](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Identity) | [1-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Identity-1), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Identity-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Identity-14) | +| [If](https://github.com/onnx/onnx/blob/master/docs/Operators.md#If) | | +| [InstanceNormalization](https://github.com/onnx/onnx/blob/master/docs/Operators.md#InstanceNormalization) | [6+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#InstanceNormalization-6) | +| [IsInf](https://github.com/onnx/onnx/blob/master/docs/Operators.md#IsInf) | | +| [IsNaN](https://github.com/onnx/onnx/blob/master/docs/Operators.md#IsNaN) | | +| [LRN](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LRN) | | +| [LSTM](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LSTM) | | +| [LeakyRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LeakyRelu) | [6+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#LeakyRelu-6) | +| [Less](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Less) | [7-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Less-7), [9-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Less-9), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Less-13) | +| [LessOrEqual](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LessOrEqual) | | +| [Log](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Log) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Log-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Log-13) | +| [LogSoftmax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LogSoftmax) | | +| [Loop](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Loop) | | +| [LpNormalization](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LpNormalization) | | +| [LpPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#LpPool) | | +| [MatMul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MatMul) | [1-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#MatMul-1), [9-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#MatMul-9), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#MatMul-13) | +| [MatMulInteger](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MatMulInteger) | | +| [Max](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Max) | | +| [MaxPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxPool) | [1-7](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#MaxPool-1), [8-9](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#MaxPool-8) | +| [MaxRoiPool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxRoiPool) | | +| [MaxUnpool](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxUnpool) | | +| [Mean](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Mean) | | +| [MeanVarianceNormalization](https://github.com/onnx/onnx/blob/master/docs/Operators.md#MeanVarianceNormalization) | | +| [Min](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Min) | | +| [Mod](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Mod) | | +| [Mul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Mul) | [7-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Mul-7), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Mul-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Mul-14) | +| [Multinomial](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Multinomial) | | +| [Neg](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Neg) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Neg-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Neg-13) | +| [NegativeLogLikelihoodLoss](https://github.com/onnx/onnx/blob/master/docs/Operators.md#NegativeLogLikelihoodLoss) | | +| [NonMaxSuppression](https://github.com/onnx/onnx/blob/master/docs/Operators.md#NonMaxSuppression) | | +| [NonZero](https://github.com/onnx/onnx/blob/master/docs/Operators.md#NonZero) | | +| [Not](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Not) | [1+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Not-1) | +| [OneHot](https://github.com/onnx/onnx/blob/master/docs/Operators.md#OneHot) | | +| [Or](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Or) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Or-7) | +| [PRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#PRelu) | [7-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#PRelu-7), [9+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#PRelu-9) | +| [Pad](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Pad) | [2-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Pad-2) | +| [Pow](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Pow) | [7-11](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Pow-7), [12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Pow-12), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Pow-13) | +| [QLinearConv](https://github.com/onnx/onnx/blob/master/docs/Operators.md#QLinearConv) | | +| [QLinearMatMul](https://github.com/onnx/onnx/blob/master/docs/Operators.md#QLinearMatMul) | | +| [QuantizeLinear](https://github.com/onnx/onnx/blob/master/docs/Operators.md#QuantizeLinear) | | +| [RNN](https://github.com/onnx/onnx/blob/master/docs/Operators.md#RNN) | | +| [RandomNormal](https://github.com/onnx/onnx/blob/master/docs/Operators.md#RandomNormal) | | +| [RandomNormalLike](https://github.com/onnx/onnx/blob/master/docs/Operators.md#RandomNormalLike) | | +| [RandomUniform](https://github.com/onnx/onnx/blob/master/docs/Operators.md#RandomUniform) | | +| [RandomUniformLike](https://github.com/onnx/onnx/blob/master/docs/Operators.md#RandomUniformLike) | | +| [Range](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Range) | | +| [Reciprocal](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Reciprocal) | | +| [ReduceL1](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceL1) | | +| [ReduceL2](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceL2) | | +| [ReduceLogSum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceLogSum) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceLogSum-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceLogSum-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceLogSum-13) | +| [ReduceLogSumExp](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceLogSumExp) | | +| [ReduceMax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceMax) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMax-1), [11](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMax-11), [12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMax-12), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMax-13) | +| [ReduceMean](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceMean) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMean-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMean-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMean-13) | +| [ReduceMin](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceMin) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMin-1), [11](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMin-11), [12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMin-12), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceMin-13) | +| [ReduceProd](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceProd) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceProd-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceProd-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceProd-13) | +| [ReduceSum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceSum) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSum-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSum-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSum-13) | +| [ReduceSumSquare](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReduceSumSquare) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSumSquare-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSumSquare-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#ReduceSumSquare-13) | +| [Relu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Relu) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Relu-6), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Relu-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Relu-14) | +| [Reshape](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Reshape) | [5-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Reshape-5), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Reshape-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Reshape-14) | +| [Resize](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Resize) | [10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Resize-10), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Resize-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Resize-13) | +| [ReverseSequence](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ReverseSequence) | | +| [RoiAlign](https://github.com/onnx/onnx/blob/master/docs/Operators.md#RoiAlign) | | +| [Round](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Round) | | +| [Scan](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Scan) | | +| [Scatter](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Scatter) | | +| [ScatterElements](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ScatterElements) | | +| [ScatterND](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ScatterND) | | +| [Selu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Selu) | | +| [SequenceAt](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SequenceAt) | | +| [SequenceConstruct](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SequenceConstruct) | | +| [SequenceEmpty](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SequenceEmpty) | | +| [SequenceErase](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SequenceErase) | | +| [SequenceInsert](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SequenceInsert) | | +| [SequenceLength](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SequenceLength) | | +| [Shape](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Shape) | | +| [Shrink](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Shrink) | | +| [Sigmoid](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sigmoid) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sigmoid-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sigmoid-13) | +| [Sign](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sign) | | +| [Sin](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sin) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sin-7) | +| [Sinh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sinh) | | +| [Size](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Size) | | +| [Slice](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Slice) | [1-9](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Slice-1), [10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Slice-10), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Slice-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Slice-13) | +| [Softmax](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Softmax) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Softmax-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Softmax-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Softmax-13) | +| [SoftmaxCrossEntropyLoss](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SoftmaxCrossEntropyLoss) | | +| [Softplus](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Softplus) | | +| [Softsign](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Softsign) | | +| [SpaceToDepth](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SpaceToDepth) | | +| [Split](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Split) | [2-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Split-2), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Split-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Split-13) | +| [SplitToSequence](https://github.com/onnx/onnx/blob/master/docs/Operators.md#SplitToSequence) | | +| [Sqrt](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sqrt) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sqrt-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sqrt-13) | +| [Squeeze](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Squeeze) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Squeeze-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Squeeze-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Squeeze-13) | +| [StringNormalizer](https://github.com/onnx/onnx/blob/master/docs/Operators.md#StringNormalizer) | | +| [Sub](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sub) | [7-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sub-7), [13](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sub-13), [14+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sub-14) | +| [Sum](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Sum) | [6-7](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sum-6), [8-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sum-8), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sum-13) | +| [Tan](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tan) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Tan-7) | +| [Tanh](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tanh) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Tanh-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Tanh-13) | +| [TfIdfVectorizer](https://github.com/onnx/onnx/blob/master/docs/Operators.md#TfIdfVectorizer) | | +| [ThresholdedRelu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#ThresholdedRelu) | | +| [Tile](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Tile) | [6-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Tile-6), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Tile-13) | +| [TopK](https://github.com/onnx/onnx/blob/master/docs/Operators.md#TopK) | | +| [Transpose](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Transpose) | [1-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Transpose-1), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Transpose-13) | +| [Trilu](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Trilu) | | +| [Unique](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Unique) | | +| [Unsqueeze](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Unsqueeze) | [1-10](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Unsqueeze-1), [11-12](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Unsqueeze-11), [13+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Unsqueeze-13) | +| [Upsample](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Upsample) | [7-8](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Upsample-7), [9](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Upsample-9) | +| [Where](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Where) | | +| [Xor](https://github.com/onnx/onnx/blob/master/docs/Operators.md#Xor) | [7+](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Xor-7) | diff --git a/js/web/package.json b/js/web/package.json index 662261261e..0c3b0e1de3 100644 --- a/js/web/package.json +++ b/js/web/package.json @@ -16,6 +16,7 @@ "scripts": { "prepare": "tsc", "build": "node ./script/build", + "build:doc": "node ./script/generate-operator-md", "test": "node ./script/prepare-test-data && node ./script/test-runner-cli", "test:e2e": "node ./test/e2e/run", "prepack": "node ./script/prepack" diff --git a/js/web/script/generate-operator-md.ts b/js/web/script/generate-operator-md.ts new file mode 100644 index 0000000000..ac0e1e6a81 --- /dev/null +++ b/js/web/script/generate-operator-md.ts @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import * as assert from 'assert'; +import * as fs from 'fs'; +import {EOL} from 'os'; +import * as path from 'path'; + +import {Attribute} from '../lib/onnxjs/attribute'; +import {WEBGL_OP_RESOLVE_RULES} from '../lib/onnxjs/backends/webgl/op-resolve-rules'; +import {Operator} from '../lib/onnxjs/operators'; +import {OpSet, resolveOperator} from '../lib/onnxjs/opset'; + +function checkSupport(type: string, range: [number, number], rules: readonly OpSet.ResolveRule[]) { + const node = {name: '', opType: type, inputs: [], outputs: [], attributes: new Attribute(undefined)}; + for (let i = range[0]; i <= range[1]; i++) { + try { + resolveOperator(node, [{domain: '', version: i}], rules); + } catch (_e) { + return false; + } + } + return true; +} + +function formatDesc(opType: string, range: [number, number], support: boolean, last: boolean) { + let versionDesc = ''; + if (support) { + versionDesc = last ? `${range[0]}+` : range[0] === range[1] ? `${range[0]}` : `${range[0]}-${range[1]}`; + versionDesc = `[${versionDesc}](https://github.com/onnx/onnx/blob/master/docs/Changelog.md#${opType}-${range[0]})`; + } + return versionDesc; +} +function dummyOpConstructor(): Operator { + return {} as any as Operator; +} + +const ops = new Map>(); +const webglCheckOnlyRules = + WEBGL_OP_RESOLVE_RULES.map(rule => [rule[0], rule[1], rule[2], dummyOpConstructor] as OpSet.ResolveRule); + +fs.readFileSync(path.join(__dirname, '../../../cmake/external/onnx/onnx/defs/operator_sets.h'), 'utf8') + .split(/\r?\n/) + .forEach(line => { + const matcher = /class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME\(\s*(\w+),\s*(\d+),\s*(\w+)\)/; + const matches = matcher.exec(line); + if (matches) { + const opset = matches[1]; + const version = Number.parseInt(matches[2], 10); + const opType = matches[3]; + + let currentSet = ops.get(opset); + if (currentSet === undefined) { + currentSet = new Map(); + ops.set(opset, currentSet); + } + + let currentOp = currentSet.get(opType); + if (currentOp === undefined) { + currentOp = []; + currentSet.set(opType, currentOp); + } + + currentOp.push(version); + } + }); + +const opsets = Array.from(ops.keys()); +assert.ok(opsets.length === 1 && opsets[0] === 'Onnx'); + +const onnxOpset = ops.get(opsets[0])!; +const opTypes = Array.from(onnxOpset.keys()).sort(); + +const doc = fs.createWriteStream(path.join(__dirname, '../docs/operators.md')); +doc.write(`## Operators Support Table${EOL}${EOL}`); +doc.write(`The following table shows [ai.onnx](https://github.com/onnx/onnx/blob/master/docs/Operators.md)\ + operators from which onnx opset version are currently supported by onnxjs. For example, \`4-6, 8+\` means\ + ONNX Runtime Web currently support opset version 4 to 6, 8 and above.${EOL}${EOL}`); +doc.write(`See [Compatibility](../README.md#Compatibility) for a list of the supported platforms.${EOL}${EOL}`); +doc.write(`*This file is automatically generated from the\ + def files via [this script](../script/generate-operator-md.ts).\ + Do not modify directly.*${EOL}${EOL}`); +doc.write(`| Operator | WebGl Backend |${EOL}`); +doc.write(`|:--------:|:-------------:|${EOL}`); + +let VERSION_MAX = 0; +onnxOpset.forEach(versions => { + versions.forEach(version => VERSION_MAX = Math.max(VERSION_MAX, version)); +}); + +for (const type of opTypes) { + const versions = onnxOpset.get(type)!.sort((a, b) => a - b); + + const webgl: string[] = []; + for (let i = 0; i < versions.length; i++) { + const last = i === versions.length - 1; + const versionRange: [number, number] = [versions[i], last ? VERSION_MAX : versions[i + 1] - 1]; + + webgl.push(formatDesc(type, versionRange, checkSupport(type, versionRange, webglCheckOnlyRules), last)); + } + + doc.write(`| [${type}](https://github.com/onnx/onnx/blob/master/docs/Operators.md#${type}) | ${ + webgl.filter(d => d.length > 0).join(', ')} |${EOL}`); +} +doc.end(); diff --git a/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml index c819b02d22..a3121b4f44 100644 --- a/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml @@ -189,9 +189,17 @@ jobs: workingDirectory: '$(Build.SourcesDirectory)\js' displayName: 'Clang-format' - script: | - node -e "a=require('child_process').execSync('git ls-files -m').toString();if(a)throw new Error('Following source files are not formatted:\n'+a)" + node -e "a=require('child_process').execSync('git ls-files -m').toString();if(a)throw new Error('Following source files are not formatted: (did you run \"npm run format\"?)\n'+a)" workingDirectory: '$(Build.SourcesDirectory)\js' displayName: 'Check unformatted files' + - script: | + npm run build:doc + workingDirectory: '$(Build.SourcesDirectory)\js\web' + displayName: 'Generating documents' + - script: | + node -e "a=require('child_process').execSync('git ls-files -m').toString();if(a)throw new Error('Following documents are not up-to-date: (did you run \"npm run build:doc\"?)\n'+a)" + workingDirectory: '$(Build.SourcesDirectory)\js\web' + displayName: 'Check out of dated documents' - script: | npm run build workingDirectory: '$(Build.SourcesDirectory)\js\web'