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
- 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
- Split
- argument
split
must be specified
- argument
- 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.6.0.tar.gz
(20.7 kB
view hashes)
Built Distribution
onnion_rt-0.6.0-py3-none-any.whl
(51.7 kB
view hashes)
Close
Hashes for onnion_rt-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22a75386c70a2fcd5f04c2c5c5964b5d37981e9510ba4b73438b1aa3befcdfcd |
|
MD5 | 1e121286ae59b6663419c857a038b0fb |
|
BLAKE2b-256 | 9dceadc81512076e115e04286a288ac4a673e295b82ac85b4e48ecbc2bc257b0 |