# onnion-rt
Note: This software includes [the work](https://github.com/onnx/onnx) that is distributed in the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).
## Installation
```
$ pip3 install onnion-rt
```
## Usage
See [tutorial](https://github.com/Idein/onnion/tree/master#tutorial).
## Development Guide
```
$ poetry install
```
### How to support new operators
1. Add `onnion_runtime/xxx.py`
- An onnx operator `Xxx` must correspond to a class `Xxx`.
- A class `Xxx` must implement `__init__` and `run` methods.
- The parameters of the `__init__` methods must be `self`, `opset_version`, and `kwargs`.
- The attributes of the operator must be passed through the `kwargs` of the `__init__` method.
- Get the required attributes by `kwargs['attr_name']`.
- Get the optional attributes by `kwargs.get('attr_name', default_value)`.
- The inputs of the operator must be passed through the arguments of the `run` method.
- The `run` method must return the list of `np.array`.
2. Add `from .xxx import Xxx # noqa: F401` to `onnion_runtime/__init__.py`
3. Update "Supported Operators" in `README.md`
4. Add `tests/test_xxx.py`
5. Run tests `poetry run pytest -v`
6. Format and lint `poetry run pysen run format && poetry run pysen run lint`
## Supported Operators
This runtime supports only below operators.
- Abs
- Acos
- Acosh
- Add
- must be from opsetversion >= 7
- And
- must be from opsetversion >= 7
- ArgMax
- ArgMin
- Asin
- Asinh
- Atan
- Atanh
- BatchNormalization
- must be from opsetversion >= 9
- BitShift
- Cast
- must be from opsetversion >= 6
- Ceil
- Celu
- Clip
- Compress
- Concat
- ConcatFromSequence
- Constant
- ConstantOfShape
- ConvTranspose
- support 2d only
- `group` should be 1
- `auto_pad` should be `"NOTSET"` (default value)
- Cos
- Cosh
- DepthToSpace
- DequantizeLinear
- Det
- Div
- must be from opsetversion >= 7
- Dropout
- DynamicQuantizeLinear
- Einsum
- Elu
- Equal
- must be from opsetversion >= 7
- Erf
- Exp
- Expand
- EyeLike
- Flatten
- Floor
- Gather
- GatherElements
- GahterND
- Gemm
- must be from opsetversion >= 7
- GlobalAveragePool
- GlobalMaxPool
- Greater
- must be from opsetversion >= 7
- GreaterOrEqual
- HardSigmoid
- HardSwish
- Hardmax
- Identity
- If
- InstanceNormalization
- IsInf
- IsNaN
- LeakyRelu
- Less
- must be from opsetversion >= 7
- LessOrEqual
- Log
- LogSoftmax
- Loop
- MatMul
- MatMulInteger
- Max
- Mean
- Min
- Mod
- Mul
- must be from opsetversion >= 7
- Neg
- NegativeLogLikelihoodLoss
- NonMaxSuppression
- NonZero
- Not
- OneHot
- Or
- must be from opsetversion >= 7
- PRelu
- Pad
- Pow
- must be from opsetversion >= 7
- RandomNormal
- RandomNormalLike
- RandomUniform
- RandomUniformLike
- Range
- Reciprocal
- ReduceL1
- ReduceL2
- ReduceLogSum
- ReduceLogSumExp
- ReduceMax
- ReduceMean
- ReduceMin
- ReduceProd
- ReduceSum
- ReduceSumSquare
- Relu
- Reshape
- Round
- ScatterND
- Shape
- Sigmoid
- Slice
- Softmax
- Split
- argument `split` must be specified
- Sqrt
- Squeeze
- Sub
- must be from opsetversion >= 7
- Tile
- must be from opsetversion >= 6
- TopK
- Transpose
- Unsqueeze
- Where
Raw data
{
"_id": null,
"home_page": "https://github.com/Idein/onnion/tree/master/runtime",
"name": "onnion-rt",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "onnx",
"author": "Idein Inc.",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/cb/2f/e7e1112fbd78f5b5fa188ba8c51d065315b8da566293215183da4cdae63b/onnion_rt-0.8.0.tar.gz",
"platform": null,
"description": "# onnion-rt\n\nNote: This software includes [the work](https://github.com/onnx/onnx) that is distributed in the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).\n\n## Installation\n\n```\n$ pip3 install onnion-rt\n```\n\n## Usage\nSee [tutorial](https://github.com/Idein/onnion/tree/master#tutorial).\n\n## Development Guide\n\n```\n$ poetry install\n```\n\n### How to support new operators\n\n1. Add `onnion_runtime/xxx.py`\n - An onnx operator `Xxx` must correspond to a class `Xxx`.\n - A class `Xxx` must implement `__init__` and `run` methods.\n - The parameters of the `__init__` methods must be `self`, `opset_version`, and `kwargs`.\n - The attributes of the operator must be passed through the `kwargs` of the `__init__` method.\n - Get the required attributes by `kwargs['attr_name']`.\n - Get the optional attributes by `kwargs.get('attr_name', default_value)`.\n - The inputs of the operator must be passed through the arguments of the `run` method.\n - The `run` method must return the list of `np.array`.\n2. Add `from .xxx import Xxx # noqa: F401` to `onnion_runtime/__init__.py`\n3. Update \"Supported Operators\" in `README.md`\n4. Add `tests/test_xxx.py`\n5. Run tests `poetry run pytest -v`\n6. Format and lint `poetry run pysen run format && poetry run pysen run lint`\n\n## Supported Operators\nThis runtime supports only below operators.\n\n- Abs\n- Acos\n- Acosh\n- Add\n - must be from opsetversion >= 7\n- And\n - must be from opsetversion >= 7\n- ArgMax\n- ArgMin\n- Asin\n- Asinh\n- Atan\n- Atanh\n- BatchNormalization\n - must be from opsetversion >= 9\n- BitShift\n- Cast\n - must be from opsetversion >= 6\n- Ceil\n- Celu\n- Clip\n- Compress\n- Concat\n- ConcatFromSequence\n- Constant\n- ConstantOfShape\n- ConvTranspose\n - support 2d only\n - `group` should be 1\n - `auto_pad` should be `\"NOTSET\"` (default value)\n- Cos\n- Cosh\n- DepthToSpace\n- DequantizeLinear\n- Det\n- Div\n - must be from opsetversion >= 7\n- Dropout\n- DynamicQuantizeLinear\n- Einsum\n- Elu\n- Equal\n - must be from opsetversion >= 7\n- Erf\n- Exp\n- Expand\n- EyeLike\n- Flatten\n- Floor\n- Gather\n- GatherElements\n- GahterND\n- Gemm\n - must be from opsetversion >= 7\n- GlobalAveragePool\n- GlobalMaxPool\n- Greater\n - must be from opsetversion >= 7\n- GreaterOrEqual\n- HardSigmoid\n- HardSwish\n- Hardmax\n- Identity\n- If\n- InstanceNormalization\n- IsInf\n- IsNaN\n- LeakyRelu\n- Less\n - must be from opsetversion >= 7\n- LessOrEqual\n- Log\n- LogSoftmax\n- Loop\n- MatMul\n- MatMulInteger\n- Max\n- Mean\n- Min\n- Mod\n- Mul\n - must be from opsetversion >= 7\n- Neg\n- NegativeLogLikelihoodLoss\n- NonMaxSuppression\n- NonZero\n- Not\n- OneHot\n- Or\n - must be from opsetversion >= 7\n- PRelu\n- Pad\n- Pow\n - must be from opsetversion >= 7\n- RandomNormal\n- RandomNormalLike\n- RandomUniform\n- RandomUniformLike\n- Range\n- Reciprocal\n- ReduceL1\n- ReduceL2\n- ReduceLogSum\n- ReduceLogSumExp\n- ReduceMax\n- ReduceMean\n- ReduceMin\n- ReduceProd\n- ReduceSum\n- ReduceSumSquare\n- Relu\n- Reshape\n- Round\n- ScatterND\n- Shape\n- Sigmoid\n- Slice\n- Softmax\n- Split\n - argument `split` must be specified\n- Sqrt\n- Squeeze\n- Sub\n - must be from opsetversion >= 7\n- Tile\n - must be from opsetversion >= 6\n- TopK\n- Transpose\n- Unsqueeze\n- Where\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "run onnx with only numpy",
"version": "0.8.0",
"project_urls": {
"Homepage": "https://github.com/Idein/onnion/tree/master/runtime",
"Repository": "https://github.com/Idein/onnion/tree/master/runtime"
},
"split_keywords": [
"onnx"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "279eb35a4e4a16ed120bde44cc55c0e36132821fd8ad03d61e06d681d35a5c87",
"md5": "1e4fcc5853ca1512a6d7f84ccf615df9",
"sha256": "7ed9854530605e790e4d875f605fc06892066884f6fa3d30d51a281d76dc0b09"
},
"downloads": -1,
"filename": "onnion_rt-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e4fcc5853ca1512a6d7f84ccf615df9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 55082,
"upload_time": "2023-07-20T09:20:42",
"upload_time_iso_8601": "2023-07-20T09:20:42.040879Z",
"url": "https://files.pythonhosted.org/packages/27/9e/b35a4e4a16ed120bde44cc55c0e36132821fd8ad03d61e06d681d35a5c87/onnion_rt-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cb2fe7e1112fbd78f5b5fa188ba8c51d065315b8da566293215183da4cdae63b",
"md5": "b944f5d9058202f46becff6355d8d925",
"sha256": "4f7971d9a91257bc7b34098c43be5ade2e469c2cbbf70652bfe859f7ccad510a"
},
"downloads": -1,
"filename": "onnion_rt-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "b944f5d9058202f46becff6355d8d925",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 22044,
"upload_time": "2023-07-20T09:20:45",
"upload_time_iso_8601": "2023-07-20T09:20:45.566064Z",
"url": "https://files.pythonhosted.org/packages/cb/2f/e7e1112fbd78f5b5fa188ba8c51d065315b8da566293215183da4cdae63b/onnion_rt-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-20 09:20:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Idein",
"github_project": "onnion",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"lcname": "onnion-rt"
}