EZ RKNN Async was designed to minimize the effort required to move an existingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/happyme531/ztu_somemodelruntime_ez_rknn_async/llms.txt
Use this file to discover all available pages before exploring further.
onnxruntime codebase to Rockchip NPU acceleration. The InferenceSession class shares the same constructor signature, the same run, get_inputs, get_outputs, and get_modelmeta methods, and the same input_feed conventions. In most cases the migration is a single import change.
Import change
Constructor and provider options
Both libraries acceptproviders and provider_options keyword arguments. ORT uses them to select CUDA, TensorRT, or CPU execution. EZ RKNN Async ignores providers (RKNN is the only backend) and reads NPU configuration from provider_options.
sess_options (ort.SessionOptions) is accepted in the constructor but silently ignored — it exists only so existing code that passes a SessionOptions object does not raise.
run: identical calling convention
run behaves the same as ORT: pass None as output_names to get all outputs, or a list of output name strings to filter. input_feed accepts a dict, a list/tuple, or a single numpy.ndarray (for single-input models).
get_inputs, get_outputs, get_modelmeta
All three methods are present and return objects with the same attribute names as ORT equivalents.
Differences to be aware of
No CUDA, CPU, or other providers
EZ RKNN Async runs exclusively on the RKNN NPU. There is no CPU fallback provider. Remove any provider selection logic and CUDA-specific code.Outputs are always float32
The RKNN output collection is called with want_float=True unconditionally. Regardless of the quantized type stored in the model, all output tensors are returned as numpy.float32 arrays. If your post-processing code expected int8 or uint8 outputs from a quantized ORT session, remove that conversion step.
run_async callback signature differs from ORT
ORT’s run_async passes (outputs, user_data). EZ RKNN Async passes (results, user_data, err) where err is an empty string on success or an error message on failure.
Bytes model content is not supported
ORT accepts either a filesystem path or raw model bytes. EZ RKNN Async only accepts a filesystem path (string oros.PathLike). Attempting to pass bytes raises RuntimeError:
bytes model content is not supported yet; please pass a filesystem path
input_names and output_names properties
EZ RKNN Async adds input_names and output_names as properties on InferenceSession for convenience. ORT does not have these; use get_inputs() and get_outputs() in portable code.
Side-by-side migration checklist
Update the session constructor
Change the model path from
.onnx to .rknn. Replace providers=["CUDAExecutionProvider"] (or any other provider list) with provider_options=make_provider_options(...).Verify run() call sites
run(None, input_feed) and run(output_names, input_feed) require no changes. Single-array and list-style input_feed also work unchanged.Update run_async callbacks
Add the third
err argument to every callback function and add error handling.Remove bytes-path code
If your code constructs a session from
bytes, switch to writing the model to a temporary file or to a fixed filesystem path first.