Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.05 KB

how-to-use-nnfw-python-api.md

File metadata and controls

48 lines (31 loc) · 1.05 KB

How to Use NNFW PYTHON API

CAUTION

This Python API is experimental yet. It can be changed later.

Prepare nnpackage

Use nnpackage examples

Use the nnpackage examples to run tutorial code.

Install nnfw python API

Please see nnfw python api for installing nnfw python api.

  1. Initialize nnfw_session
import onert

# Create session and load nnpackage
# The default value of backends is "cpu".
session = onert.infer.session(nnpackage_path, backends)
  1. Prepare Input
# Prepare input. Here we just allocate dummy input arrays.
input_size = session.input_size()
session.set_inputs(input_size)
  1. Inference
# Do inference
outputs = session.inference()

Run Inference with app on the target devices

reference app : minimal-python app

$ python3 minimal.py path_to_nnpackage_directory