diff --git a/dnnlibrary/ModelBuilder.cpp b/dnnlibrary/ModelBuilder.cpp index 2f12c86..52c7cbc 100644 --- a/dnnlibrary/ModelBuilder.cpp +++ b/dnnlibrary/ModelBuilder.cpp @@ -266,27 +266,6 @@ ModelBuilder::Shape ModelBuilder::GetBlobDim(uint32_t index) { throw std::invalid_argument("Wrong index in GetBlobDim"); } -template -ModelBuilder::IndexSeq ModelBuilder::AddOperation( - int op, IndexSeq input_indexes, OperandTypes... operand_types) { - using android::nn::wrapper::OperandType; - vector types; - (types.push_back(operand_types), ...); - IndexSeq output_indexes; - for (const auto &type : types) { - auto index = AddNewOperand(type); - output_indexes.push_back(index); - } - - THROW_ON_ERROR_WITH_NOTE( - nnapi_->ANeuralNetworksModel_addOperation( - dnn_model_->model_, op, input_indexes.size(), &input_indexes[0], - output_indexes.size(), &output_indexes[0]), - "op = " + std::to_string(op)); - - return output_indexes; -} - void ModelBuilder::Prepare() { dnn_model_ = std::unique_ptr(new Model()); const auto ret = nnapi_->ANeuralNetworksModel_create(&dnn_model_->model_); diff --git a/dnnlibrary/ModelBuilderImpl.cpp b/dnnlibrary/ModelBuilderImpl.cpp index febaf81..df9873e 100644 --- a/dnnlibrary/ModelBuilderImpl.cpp +++ b/dnnlibrary/ModelBuilderImpl.cpp @@ -632,4 +632,26 @@ ModelBuilder::Index ModelBuilder::AddMul( return AddMul(input1_name, input2_name, ANEURALNETWORKS_FUSED_NONE, output_name, output_quant_info); } + +template +ModelBuilder::IndexSeq ModelBuilder::AddOperation( + int op, IndexSeq input_indexes, OperandTypes... operand_types) { + using android::nn::wrapper::OperandType; + std::vector types; + (types.push_back(operand_types), ...); + IndexSeq output_indexes; + for (const auto &type : types) { + auto index = AddNewOperand(type); + output_indexes.push_back(index); + } + + THROW_ON_ERROR_WITH_NOTE( + nnapi_->ANeuralNetworksModel_addOperation( + dnn_model_->model_, op, input_indexes.size(), &input_indexes[0], + output_indexes.size(), &output_indexes[0]), + "op = " + std::to_string(op)); + + return output_indexes; +} + } // namespace dnn