ANeuralNetworksExecution_setOutput

Function ANeuralNetworksExecution_setOutput 

Source
pub unsafe extern "C" fn ANeuralNetworksExecution_setOutput(
    execution: *mut ANeuralNetworksExecution,
    index: i32,
    type_: *const ANeuralNetworksOperandType,
    buffer: *mut c_void,
    length: usize,
) -> c_int
Expand description

Associate a user buffer with an output 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 buffer until the execution has completed.

If the output is optional, you can indicate that it is omitted by passing nullptr for buffer and 0 for length.

The provided buffer must outlive the execution.

See {@link ANeuralNetworksExecution} for information on multithreaded usage.

Available since API level 27.

@param execution The execution to be modified. @param index The index of the output 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. Unless the output is omitted, 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_setOutput}. Since API level 29, the output operand can have unspecified dimensions or rank to be deduced dynamically during the execution. However, the user must provide a large enough buffer. The user can retrieve the output dimensional information after the execution by {@link ANeuralNetworksExecution_getOutputOperandRank} and {@link ANeuralNetworksExecution_getOutputOperandDimensions}. @param buffer The buffer where the data is to be written. @param length The length in bytes of the buffer.

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