ResultCode
ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation)
{
+ // Set 'inputs' and 'outputs'
+ compilation->output().inputs = compilation->model().inputs;
+ compilation->output().outputs = compilation->model().outputs;
+
return ANEURALNETWORKS_NO_ERROR;
}
private:
operand::Context _operands;
op::Sequence _ops;
+
+public:
+ // TODO Hide these fields
+ std::vector<tflite::operand::Index> inputs;
+ std::vector<tflite::operand::Index> outputs;
};
} // namepsace arm_compute
uint32_t inputCount, const uint32_t* inputs,
uint32_t outputCount, const uint32_t* outputs)
{
+ // NOTE ::internal::tflite::operand::Index uses int as its underlying type as various NNAPI
+ // functions such as ANeuralNetworksModel_setOperandValue use int to represent operand index
+ //
+ // ANeuralNetworksModel_identifyInputsAndOutputs, however, uses uint32_t to represent operand
+ // index.
+ //
+ // Below, static_cast<int>(...) is introduced to eliminate compiler warning.
+ for (uint32_t n = 0; n < inputCount; ++n)
+ {
+ const ::internal::tflite::operand::Index ind{static_cast<int>(inputs[n])};
+ model->deref().inputs.emplace_back(ind);
+ }
+
+ for (uint32_t n = 0; n < outputCount; ++n)
+ {
+ const ::internal::tflite::operand::Index ind{static_cast<int>(outputs[n])};
+ model->deref().outputs.emplace_back(ind);
+ }
+
return ANEURALNETWORKS_NO_ERROR;
}