run onnx with only numpy
Project description
onnion-rt
Note: This software includes the work that is distributed in the Apache License 2.0.
Installation
$ pip3 install onnion-rt
Usage
See tutorial.
Development Guide
$ poetry install
How to support new operators
- Add
onnion_runtime/xxx.py
- An onnx operator
Xxxmust correspond to a classXxx. - A class
Xxxmust implement__init__andrunmethods. - The parameters of the
__init__methods must beself,opset_version, andkwargs. - The attributes of the operator must be passed through the
kwargsof the__init__method.- Get the required attributes by
kwargs['attr_name']. - Get the optional attributes by
kwargs.get('attr_name', default_value).
- Get the required attributes by
- The inputs of the operator must be passed through the arguments of the
runmethod. - The
runmethod must return the list ofnp.array.
- Add
from .xxx import Xxx # noqa: F401toonnion_runtime/__init__.py - Update "Supported Operators" in
README.md - Add
tests/test_xxx.py - Run tests
poetry run pytest -v - 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
groupshould be 1auto_padshould 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
splitmust be specified
- argument
- Sqrt
- Squeeze
- Sub
- must be from opsetversion >= 7
- Tile
- must be from opsetversion >= 6
- TopK
- Transpose
- Unsqueeze
- Where
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onnion_rt-0.8.0.tar.gz
(22.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
onnion_rt-0.8.0-py3-none-any.whl
(55.1 kB
view details)
File details
Details for the file onnion_rt-0.8.0.tar.gz.
File metadata
- Download URL: onnion_rt-0.8.0.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1039-aws
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f7971d9a91257bc7b34098c43be5ade2e469c2cbbf70652bfe859f7ccad510a
|
|
| MD5 |
b944f5d9058202f46becff6355d8d925
|
|
| BLAKE2b-256 |
cb2fe7e1112fbd78f5b5fa188ba8c51d065315b8da566293215183da4cdae63b
|
File details
Details for the file onnion_rt-0.8.0-py3-none-any.whl.
File metadata
- Download URL: onnion_rt-0.8.0-py3-none-any.whl
- Upload date:
- Size: 55.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1039-aws
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ed9854530605e790e4d875f605fc06892066884f6fa3d30d51a281d76dc0b09
|
|
| MD5 |
1e4fcc5853ca1512a6d7f84ccf615df9
|
|
| BLAKE2b-256 |
279eb35a4e4a16ed120bde44cc55c0e36132821fd8ad03d61e06d681d35a5c87
|