File NeuralNetwork.java

Definition (NeuralNetwork.java)

Full File Listing

namespace snpe
interface NeuralNetwork

NeuralNetwork helper functions and properties.

Subclassed by com.qualcomm.qti.snpe.internal.NativeNetwork

Public Functions

NeuralNetwork.Runtime getRuntime ()

See also

com.qualcomm.qti.snpe.SNPE.NeuralNetworkBuilder::setRuntimeOrder(Runtime…)

Returns

The neural network’s selected runtime.

Set<String> getOutputLayers()

Returns

The selected output layer(s) name(s).

Map<String, FloatTensor> execute(Map<String, FloatTensor> inputs)

Forward propagates the inputs through the neural network.

Parameters

inputs – map of input name and tensor.

Returns

a map of output name and tensor.

boolean execute (Map< String, ? extends UserBufferTensor > inputs, Map< String, ? extends UserBufferTensor > outputs)

Forward propagates the inputs through the neural network.

Parameters

inputs – map of input name and user buffer tensor.

Returns

a map of output name and user buffer tensor.

Map<String, int[]> getInputTensorsShapes()
Returns

a map of the input tensors(s) shape(s).

Map<String, int[]> getOutputTensorsShapes()
Returns

a map of the input tensors(s) shape(s).

Set<String> getInputTensorsNames()
Returns

a set with the input tensor(s) name(s).

Set<String> getOutputTensorsNames()
Returns

a set with the output tensor(s) name(s).

TensorAttributes getTensorAttributes(String name)
Parameters

name – name of the network tensor.

Returns

object representing the attributes of the tensor.

String getModelVersion()
Returns

the user defined model version.

void release()

Releases the neural network’s resources. After this call you can no longer invoke any methods on this class instance.

FloatTensor createFloatTensor(int... shape)

Creates a FloatTensor instance with the specified shape.

Parameters

shape – tensor shape.

Returns

newly created instance.

TF8UserBufferTensor createTF8UserBufferTensor (final int size, final int[] strides, int stepExactly0, float quantizedStepSize, ByteBuffer userBuffer)

Creates a TF8UserBufferTensor instance to wrap a user buffer.

Parameters
  • 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.

Returns

newly created instance

TF16UserBufferTensor createTF16UserBufferTensor (final int size, final int[] strides, int stepExactly0, float quantizedStepSize, ByteBuffer userBuffer)

Creates a TF16UserBufferTensor instance to wrap a user buffer.

Parameters
  • 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.

Returns

newly created instance