ANeuralNetworksExecution_setInputFromMemory

Function ANeuralNetworksExecution_setInputFromMemory 

Source
pub unsafe extern "C" fn ANeuralNetworksExecution_setInputFromMemory(
    execution: *mut ANeuralNetworksExecution,
    index: i32,
    type_: *const ANeuralNetworksOperandType,
    memory: *const ANeuralNetworksMemory,
    offset: usize,
    length: usize,
) -> c_int
Expand description

Associate a region of a memory object with an input of the model of the {@link ANeuralNetworksExecution}. Evaluation of the execution must not have been scheduled. Once evaluation of the execution has been scheduled, the application must not change the content of the region until the execution has completed. Evaluation of the execution will not change the content of the region.

The provided memory must outlive the execution.

If the input is optional, you can indicate that it is omitted by using {@link ANeuralNetworksExecution_setInput} instead, passing nullptr for buffer and 0 for length.

See {@link ANeuralNetworksExecution} for information on multithreaded usage. See {@link ANeuralNetworksMemory_createFromAHardwareBuffer} for information on AHardwareBuffer usage. See {@link ANeuralNetworksMemory_createFromDesc} for information on usage of memory objects created from memory descriptors.

Available since API level 27.

@param execution The execution to be modified. @param index The index of the input argument we are setting. It is an index into the lists passed to {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not the index associated with {@link ANeuralNetworksModel_addOperand}. @param type The {@link ANeuralNetworksOperandType} of the operand. This should be used to specify the dimensions that were left unspecified when the operand was added to the model. All other properties of the type must be the same as specified in the model. If the type is the same as specified when the model was built, NULL can be passed. Neither the {@link ANeuralNetworksOperandType} nor the dimensions it points to need to outlive the call to {@link ANeuralNetworksExecution_setInputFromMemory}. @param memory The memory containing the data. @param offset This specifies the location of the data within the memory. The offset is in bytes from the start of memory. @param length The size in bytes of the data value.

@return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if the name is not recognized or the buffer is too small for the input.