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
Xxx
must correspond to a classXxx
. - A class
Xxx
must implement__init__
andrun
methods. - The parameters of the
__init__
methods must beself
,opset_version
, andkwargs
. - 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)
.
- Get the required attributes by
- The inputs of the operator must be passed through the arguments of the
run
method. - The
run
method must return the list ofnp.array
.
- Add
from .xxx import Xxx # noqa: F401
toonnion_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
- BitShift
- Cast
- must be from opsetversion >= 6
- Ceil
- Celu
- Clip
- Compress
- Concat
- ConcatFromSequence
- Constant
- ConstantOfShape
- 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
- Loop
- Mul
- must be from opsetversion >= 7
- NonMaxSuppression
- NonZero
- Pad
- Range
- ReduceMax
- ReduceMin
- Reshape
- Round
- ScatterND
- Shape
- Sigmoid
- Slice
- 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.4.0.tar.gz
(15.7 kB
view hashes)
Built Distribution
onnion_rt-0.4.0-py3-none-any.whl
(37.0 kB
view hashes)
Close
Hashes for onnion_rt-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50fbf833dad1ae79a2ed23d29fede293865c2162e5d295139a5caa0d44395220 |
|
MD5 | 9b8c66e3b1031335e84929e0e264ea24 |
|
BLAKE2b-256 | 5fea882f8c84efa0780bab82dd1ebae219670400f6eb53901bb4454608575efa |