Snapdragon Neural Processing Engine SDK
Reference Guide
|
Classes | |
class | FloatTensor |
interface | NeuralNetwork |
class | PlatformValidator |
class | SNPE |
class | SnpeError |
class | Tensor |
interface | TensorAttributes |
class | TF8UserBufferTensor |
class | UserBufferTensor |
Functions | |
boolean | isRuntimeAvailable (final Application application) |
String | coreVersion (final Application application) |
String | libVersion (final Application application) |
boolean | runtimeCheck (final Application application) |
This module defines the SNPE Java APIs
class com::qualcomm::qti::snpe::FloatTensor |
Tensor class containing float elements.
Public Member Functions | |
abstract void | write (float[] value, int offset, int length, int... position) |
abstract void | write (float value, int... position) |
abstract int | read (float[] value, int offset, int length, int... position) |
abstract float | read (int... position) |
Public Member Functions inherited from Tensor | |
int [] | getShape () |
int | getSize () |
abstract void | release () |
|
abstract |
Reads elements from the tensor into the specified array range starting at the specified tensor position.
value | array to read values into. |
offset | start offset to write into array. |
length | number of elements to write into array. |
position | the zero indexed position for each of the tensor dimensions to start reading from. |
|
abstract |
Reads a single value from the tensor.
position | the zero indexed position for each of the tensor dimensions to start reading from. |
|
abstract |
Writes the range of the provided input array into the tensor at the specified position.
value | float values to write. |
offset | start position to read from the input array. |
length | number of floats to read from the input array. |
position | the zero indexed position for each of the tensor dimensions to start writing to. |
|
abstract |
Writes a single float value to the specified position.
value | float value. |
position | the zero indexed position for each of the tensor dimensions to start writing to. |
interface com::qualcomm::qti::snpe::NeuralNetwork |
NeuralNetwork helper functions and properties.
Public Member Functions | |
NeuralNetwork.Runtime | getRuntime () |
Set< String > | getOutputLayers () |
Map< String, FloatTensor > | execute (Map< String, FloatTensor > inputs) |
boolean | execute (Map< String, ? extends UserBufferTensor > inputs, Map< String, ? extends UserBufferTensor > outputs) |
Map< String, int[]> | getInputTensorsShapes () |
Map< String, int[]> | getOutputTensorsShapes () |
Set< String > | getInputTensorsNames () |
Set< String > | getOutputTensorsNames () |
TensorAttributes | getTensorAttributes (String name) |
String | getModelVersion () |
void | release () |
FloatTensor | createFloatTensor (int... shape) |
TF8UserBufferTensor | createTF8UserBufferTensor (final int size, final int[] strides, int stepExactly0, float quantizedStepSize, ByteBuffer userBuffer) |
FloatTensor createFloatTensor | ( | int... | shape | ) |
Creates a FloatTensor instance with the specified shape.
shape | tensor shape. |
TF8UserBufferTensor createTF8UserBufferTensor | ( | final int | size, |
final int [] | strides, | ||
int | stepExactly0, | ||
float | quantizedStepSize, | ||
ByteBuffer | userBuffer | ||
) |
Creates a TF8UserBufferTensor instance to wrap a user buffer.
size | total size of the buffer, in bytes |
strides | total number of bytes between elements in each dimension |
stepExactly0 | step value that represents exactly 0.0 |
quantizedStepSize | step size |
userBuffer | byte buffer that contains user data. This buffer must have been allocated using direct allocation and possess native byte ordering. |
Map<String, FloatTensor> execute | ( | Map< String, FloatTensor > | inputs | ) |
Forward propagates the inputs through the neural network.
inputs | map of input name and tensor. |
boolean execute | ( | Map< String, ? extends UserBufferTensor > | inputs, |
Map< String, ? extends UserBufferTensor > | outputs | ||
) |
Forward propagates the inputs through the neural network.
inputs | map of input name and user buffer tensor. |
Set<String> getInputTensorsNames | ( | ) |
Map<String, int[]> getInputTensorsShapes | ( | ) |
String getModelVersion | ( | ) |
Set<String> getOutputLayers | ( | ) |
Set<String> getOutputTensorsNames | ( | ) |
Map<String, int[]> getOutputTensorsShapes | ( | ) |
NeuralNetwork.Runtime getRuntime | ( | ) |
TensorAttributes getTensorAttributes | ( | String | name | ) |
name | name of the network tensor. |
void release | ( | ) |
Releases the neural network's resources. After this call you can no longer invoke any methods on this class instance.
class com::qualcomm::qti::platformvalidator::PlatformValidator |
PlatformValidator class - top level APIs of the SNPE Platform Validator.
Public Member Functions | |
boolean | isRuntimeAvailable (final Application application) |
String | coreVersion (final Application application) |
String | libVersion (final Application application) |
boolean | runtimeCheck (final Application application) |
class com::qualcomm::qti::snpe::SNPE |
SNPE class - top level APIs of the Snapdragon Neural Network Engine.
Static Public Member Functions | |
static String | getRuntimeVersion (final Application application) |
static boolean | addOpPackage (final Application application, String regLibrary) |
Static Public Attributes | |
static final String | LOG_TAG = "snpe-android" |
|
inlinestatic |
Registers a UDO Package Registration Library
application | the application registering the package |
regLibraryPath | Path to registration library |
|
inlinestatic |
Returns the version of the Snapdragon Neural Network Engine.
|
static |
Log tag used internally by the SDK.
class com::qualcomm::qti::snpe::SnpeError |
SnpeError throws exceptions with code and message
class com::qualcomm::qti::snpe::Tensor |
Tensor class.
Public Member Functions | |
int [] | getShape () |
int | getSize () |
abstract void | release () |
|
inline |
Returns the shape of the tensor.
|
inline |
Returns the number of elements in the tensor.
|
abstract |
Releases the resources used by this tensor. After this call no other methods can be called on this instance!
interface com::qualcomm::qti::snpe::TensorAttributes |
class representing attributes of a tensor
Public Member Functions | |
int [] | getDims () |
int [] | getAlignments () |
int | getElementSize () |
Encoding | getEncoding () |
int [] getAlignments | ( | ) |
Returns the alignment requirements of the tensor
Alignment per each dimension is expressed as an multiple, for example, if one particular dimension can accept multiples of 8, the alignment will be 8.
int [] getDims | ( | ) |
Returns the dimensions attribute
int getElementSize | ( | ) |
Returns the tensor's element size, in bytes
Encoding getEncoding | ( | ) |
Returns the tensor's encoding type
class com::qualcomm::qti::snpe::TF8UserBufferTensor |
UserBufferTensor class representing TF8 user buffer elements.
Public Member Functions | |
Encoding | getEncoding () |
abstract int | getStepExactly0 () |
abstract float | getQuantizedStepSize () |
Public Member Functions inherited from UserBufferTensor | |
int [] | getStrides () |
int | getSize () |
abstract Encoding | getEncoding () |
abstract void | release () |
|
inline |
Returns the encoding type of the tensor.
|
abstract |
Returns the step size.
|
abstract |
Returns the step that represents exactly 0.0.
class com::qualcomm::qti::snpe::UserBufferTensor |
UserBufferTensor class representing user buffer tensors.
Public Member Functions | |
int [] | getStrides () |
int | getSize () |
abstract Encoding | getEncoding () |
abstract void | release () |
|
abstract |
Returns the encoding type of the tensor.
|
inline |
Returns the total size of the tensor.
|
inline |
Returns the strides of the tensor.
|
abstract |
Releases the resources used by this tensor. After this call no other methods can be called on this instance!
|
inline |
Checks core version of the runtime
Application | context of the caller |
|
inline |
Checks if the runtime associated with the object is available or not
Application | context of the caller |
|
inline |
Checks library version of the runtime
Application | context of the caller |
|
inline |
Checks SNPE runtime availability
Application | context of the caller |