ANeuralNetworksModel_setOperandValueFromMemory

Function ANeuralNetworksModel_setOperandValueFromMemory 

Source
pub unsafe extern "C" fn ANeuralNetworksModel_setOperandValueFromMemory(
    model: *mut ANeuralNetworksModel,
    index: i32,
    memory: *const ANeuralNetworksMemory,
    offset: usize,
    length: usize,
) -> c_int
Expand description

Sets an operand to a value stored in a memory object.

The content of the memory is not copied. A reference to that memory is stored inside the model. The application must not change the content of the memory region until all executions using this model have completed. As the data may be copied during processing, modifying the data after this call yields undefined results.

The provided memory must outlive this model.

To indicate that an optional operand should be considered missing, use {@link ANeuralNetworksModel_setOperandValue} instead, passing nullptr for buffer.

It is disallowed to set an operand value with shared memory backed by an AHardwareBuffer of a format other than AHARDWAREBUFFER_FORMAT_BLOB.

It is disallowed to set an operand value with memory created from {@link ANeuralNetworksMemory_createFromDesc}.

Attempting to modify a model once {@link ANeuralNetworksModel_finish} has been called will return an error.

See {@link ANeuralNetworksModel} for information on multithreaded usage. See {@link ANeuralNetworksMemory_createFromAHardwareBuffer} for information on AHardwareBuffer usage.

Available since API level 27.

@param model The model to be modified. @param index The index of the model operand we’re setting. @param buffer A pointer to the data to use. @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.