Skip to main content
This module provides core functionality for testing library initialization and detecting hardware acceleration support on different platforms.

testSherpaInit()

Test method to verify that the sherpa-onnx native library is loaded correctly.

Returns

string
Resolves with a test message confirming the library is loaded.

Example


getQnnSupport()

Check Qualcomm QNN (Qualcomm Neural Network) acceleration support on Android devices.

Parameters

string
Optional base64-encoded model for session initialization test. If omitted, uses an embedded test model.

Returns

object

Platform Support

  • Android: Full support on Qualcomm devices
  • iOS: Returns all false

Example


getNnapiSupport()

Check NNAPI (Android Neural Networks API) acceleration support on Android devices.

Parameters

string
Optional base64-encoded model for session initialization test.

Returns

object
See getQnnSupport() for structure.

Platform Support

  • Android: Support varies by device and Android version
  • iOS: Returns all false

Example


getXnnpackSupport()

Check XNNPACK (CPU-optimized) acceleration support.

Parameters

string
Optional base64-encoded model for session initialization test.

Returns

object

Platform Support

  • Android: Full support (CPU-optimized inference)
  • iOS: Returns all false

Example


getCoreMlSupport()

Check Core ML acceleration support on iOS devices with Apple Neural Engine.

Parameters

string
Optional base64-encoded model for session initialization test.

Returns

object

Platform Support

  • iOS: Full support on iOS 11+ with Apple Neural Engine
  • Android: Returns all false

Example


getAvailableProviders()

Get the list of available ONNX Runtime execution providers on the current device.

Returns

string[]
Array of provider names (e.g., ["CPU", "NNAPI", "QNN", "XNNPACK"]).

Platform Support

Requires the ONNX Runtime Java bridge from the onnxruntime AAR.

Example


Types

AccelerationSupport

Result type for hardware acceleration queries.

See Also