Class exposes a way to configure and create NeuralNetwork instances.
◆ build()
Builds a NeuralNetwork instance based on this builder's configuration.
- Returns
- New network instance.
◆ setCpuFallbackEnabled()
Enables/Disables falling back to CPU if a layer is not supported in the selected runtime.
- Parameters
-
◆ setExecutionPriorityHint()
Passes an execution priority hint to the runtime
- Parameters
-
priority | target execution priority. |
- Returns
- the builder itself.
◆ setInitCacheEnabled()
NeuralNetworkBuilder setInitCacheEnabled |
( |
boolean |
isInitCacheEnabled, |
|
|
String |
cacheTag, |
|
|
Context |
context |
|
) |
| throws SnpeError.IllegalArgsOrStateException |
|
inline |
Enable/disable the functionality of init caching. Init caching creates a set of init caches during network building/initialization process and adds them to DLC container. If such DLC container is saved by the user, in subsequent network building/initialization processes these init caches will be loaded from the DLC so as to reduce initialization time.
- Parameters
-
isInitCacheEnabled | enables/disables the functionality of init caching. |
cacheTag | The init caches are saved into a location under this tag name. |
context | The android context from which the network is created. |
- Returns
- The current instance of NeuralNetworkBuilder.
◆ setInputDimensions()
Sets network's input dimensions to enable resizing of dimensions of the network.
- Parameters
-
inputDimensions | map of input names and their new dimensions. |
- Returns
- the builder itself
◆ setModel() [1/2]
Reads the model from the provided InputStream. The caller is responsible to close the stream after calling this method. After build() has been called, it is required that this method be invoked to re-set the input stream before every successive call to build() on the same instance.
- Parameters
-
stream | input stream from where to read the model from. |
size | number of bytes to read from the stream. |
- Returns
- the builder itself.
- Exceptions
-
IOException | if not able to read from the stream. |
◆ setModel() [2/2]
Sets the file from where to read the DLC model from.
- Parameters
-
- Returns
- the builder itself.
- Exceptions
-
IOException | if not able to read from the stream. |
◆ setOutputLayers()
Sets the output layers to return when NeuralNetwork#execute(Map) is called.
- Parameters
-
outputLayers | name of the output layers to retrieve. |
- Returns
- the builder itself.
◆ setPerformanceProfile()
Selects a performance profile to use during the network execution.
- Parameters
-
profile | target performance profile. |
- Returns
- the builder itself.
◆ setRuntimeCheckOption()
NeuralNetworkBuilder setRuntimeCheckOption |
( |
final NeuralNetwork.RuntimeCheckOption |
runtimeCheckOption | ) |
|
|
inline |
Sets Unsigned PD constraint while building network
- Parameters
-
◆ setRuntimeOrder()
Sets the runtime selection order for the neural network.
- Parameters
-
order | array with the priority order for selecting an available runtime. |
- Returns
- the builder itself.
◆ setStorageDirectory()
NeuralNetworkBuilder setStorageDirectory |
( |
String |
storageDirectory | ) |
throws SnpeError.SnpeIOException |
|
inline |
Set the SNPE storage location for all SNPE instances in this process. This may only be called once, and if so must be called before creating any SNPE instances
- Parameters
-
Absolute | path to a directory which SNPE may use for caching and other storage purposes. |
- Returns
- The current instance of NeuralNetworkBuilder.
◆ setUnsignedPD()
Sets Unsigned PD constraint while building network
- Parameters
-
◆ setUseUserSuppliedBuffers()
Sets whether this network will perform inference with input from user-supplied buffers.
- Parameters
-
The documentation for this class was generated from the following file: