This Python API is experimental yet. It can be changed later.
Use the nnpackage examples to run tutorial code.
Please see nnfw python api for installing nnfw python api.
- Initialize nnfw_session
import onert
# Create session and load nnpackage
# The default value of backends is "cpu".
session = onert.infer.session(nnpackage_path, backends)
- Prepare Input
# Prepare input. Here we just allocate dummy input arrays.
input_size = session.input_size()
session.set_inputs(input_size)
- Inference
# Do inference
outputs = session.inference()
reference app : minimal-python app
$ python3 minimal.py path_to_nnpackage_directory