ANeuralNetworksModel_addOperand

Add an operand to a model.

The order in which the operands are added is important. The first one added to a model will have the index value 0, the second 1, etc. These indexes are used as operand identifiers in {@link ANeuralNetworksModel_addOperation}, {@link ANeuralNetworksModel_identifyInputsAndOutputs}, {@link ANeuralNetworksModel_setOperandValue}, {@link ANeuralNetworksModel_setOperandValueFromMemory}, {@link ANeuralNetworksExecution_setInput}, {@link ANeuralNetworksExecution_setInputFromMemory}, {@link ANeuralNetworksExecution_setOutput}, {@link ANeuralNetworksExecution_setOutputFromMemory} and {@link ANeuralNetworksExecution_setOperandValue}.

<p>Every operand must be referenced in exactly one of the following ways:<ul> <li>It is identified as a model input with {@link ANeuralNetworksModel_identifyInputsAndOutputs}.</li> <li>It is identified as a constant with {@link ANeuralNetworksModel_setOperandValue} or {@link ANeuralNetworksModel_setOperandValueFromMemory}.</li> <li>It is identified as an output of exactly one operation with {@link ANeuralNetworksModel_addOperation}.</li></p> <p>An operand that is identified as a model input or as a constant must not also be identified as a model output with {@link ANeuralNetworksModel_identifyInputsAndOutputs}.</p>

To build a model that can accommodate inputs of various sizes, as you may want to do for a CNN, leave unspecified the dimensions that will vary at run time. If you do so, fully specify dimensions when calling {@link ANeuralNetworksExecution_setInput} or {@link ANeuralNetworksExecution_setInputFromMemory}.

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

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

Available since API level 27.

@param model The model to be modified. @param type The {@link ANeuralNetworksOperandType} that describes the shape of the operand. Neither the {@link ANeuralNetworksOperandType} nor the dimensions it points to need to outlive the call to {@link ANeuralNetworksModel_addOperand}.

@return ANEURALNETWORKS_NO_ERROR if successful.

version(Android)
extern (C) @system nothrow @nogc
int
ANeuralNetworksModel_addOperand

Meta