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.
- Add
- must be from opsetversion >= 7
- Cast
- must be from opsetversion >= 6
- Concat
- Div
- must be from opsetversion >= 7
- Exp
- Gather
- Mul
- must be from opsetversion >= 7
- NonMaxSuppression
- ReduceMin
- Reshape
- Shape
- Slice
- Squeeze
- Sub
- must be from opsetversion >= 7
- TopK
- Unsqueeze
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.2.1.tar.gz
(6.6 kB
view hashes)
Built Distribution
onnion_rt-0.2.1-py3-none-any.whl
(10.9 kB
view hashes)
Close
Hashes for onnion_rt-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16f433502d837565b08f0d2958e1b24aaa37eccf1917c450ce118021cae2589f |
|
MD5 | f065ec597026b5e1cdcc78859ae98e8e |
|
BLAKE2b-256 | 893943bbfb1482536c58b16bae9e2ae17e030358f88a61a7ba118fd72568cf99 |