Skip to content

Commit

Permalink
[onert] add docs for nnfwapi package
Browse files Browse the repository at this point in the history
This commit add README.md file including how to use nnfw python API with nnfwapi package.

ONE-DCO-1.0-Signed-off-by: KangInyeong kiyoog02@gmail.com
Co-authored-by: blue4683 <an4683@gmail.com>
Co-authored-by: jaemaning <lovesay00@naver.com>
Co-authored-by: phj799 <phj799@naver.com>
Co-authored-by: seohhh <shy1624@naver.com>
Co-authored-by: jeonghwanin <jhpc0128@naver.com>
  • Loading branch information
6 people committed Sep 26, 2023
1 parent 05fb650 commit ef59600
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
46 changes: 46 additions & 0 deletions infra/nnfw/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# nnfwapi package

`nnfwapi` is a package to run `nnpackage` with nnfw python API.

This package includes nnfw python API module resulted from runtime build.

It is provided separately according to each architecture(x86_64, armv7l, aarch64) from `nnfwapi/libnnfw_api_pybind.py` interface.

## Requirement

`nnfwapi` should be installed from PyPI.

```
$ pip install nnfwapi
```

By specifying the version, you can use a specific version of the package.

```
$ pip install nnfwapi==0.1.0
```

## Usage

This definition have to be set on the top of the script used nnfw python API.

```
from nnfwapi.libnnfw_api_pybind import *
```

## Packaging and Publishing

`pack.sh` is written for publishing this package to PyPI easily.

```
$ sudo apt install twine
```
For publishing the package, twine should be installed.

Execute this command, then the tasks such as copying modules, packaging, and publishing are automatically performed.

```
sh pack.sh
```

Before publishing, be carefule to edit the information on `setup.py` such as version, description, etc.
4 changes: 3 additions & 1 deletion infra/nnfw/python/nnfwapi/libnnfw_api_pybind.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def nnfw_session(*args):
elif (num == 3):
return libnnfw_api_pybind.nnfw_session(args[0], args[2], args[1])
else:
print("TypeError: nnfw_session() takes 2(MODEL, BACKEND) or 3(MODEL, BACKEND, OPERATION) positional arguments but {} were given".format(num))
print(
"TypeError: nnfw_session() takes 2(MODEL, BACKEND) or 3(MODEL, BACKEND, OPERATION) positional arguments but {} were given".
format(num))
return


Expand Down

0 comments on commit ef59600

Please sign in to comment.