diff options
Diffstat (limited to 'runtimes/neurun/src/frontend/wrapper/model.cc')
-rw-r--r-- | runtimes/neurun/src/frontend/wrapper/model.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/runtimes/neurun/src/frontend/wrapper/model.cc b/runtimes/neurun/src/frontend/wrapper/model.cc index c7ccbc60a..a7a9275fc 100644 --- a/runtimes/neurun/src/frontend/wrapper/model.cc +++ b/runtimes/neurun/src/frontend/wrapper/model.cc @@ -21,7 +21,8 @@ // // ANeuralNetworksModel // -ANeuralNetworksModel::ANeuralNetworksModel() : _model{new neurun::graph::Graph} +ANeuralNetworksModel::ANeuralNetworksModel() + : _model{new neurun::graph::Graph}, _optional_operands{} { // DO NOTHING } @@ -34,7 +35,24 @@ ResultCode ANeuralNetworksModel::finish() return ANEURALNETWORKS_BAD_STATE; } + fillOptionalOperand(); + _model->finishBuilding(); return ANEURALNETWORKS_NO_ERROR; } + +void ANeuralNetworksModel::fillOptionalOperand(void) +{ + _model->operations().iterate( + [&](const ::neurun::model::operation::Index &, ::neurun::model::operation::Node &node) { + for (auto input : node.getInputs()) + { + // TODO fill default value for optional operands + if (_optional_operands.find(input) != _optional_operands.end()) + { + throw std::runtime_error{"Optional operand is not supported yet"}; + } + } + }); +} |