Skip to main content

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

  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.
  1. Add from .xxx import Xxx # noqa: F401 to onnion_runtime/__init__.py
  2. Update "Supported Operators" in README.md
  3. Add tests/test_xxx.py
  4. Run tests poetry run pytest -v
  5. 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


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.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

onnion_rt-0.2.0-py3-none-any.whl (10.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page