Skip to content

Commit

Permalink
Merge pull request #57 from JDAI-CV/support_onnx_model_output
Browse files Browse the repository at this point in the history
support onnx model output
  • Loading branch information
daquexian authored Jun 24, 2019
2 parents 99baa7b + a75548d commit 90cb0f8
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 106 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ IndentWidth: 4
AllowShortBlocksOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlignEscapedNewlines: Left
1 change: 1 addition & 0 deletions common/daq.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ table Model {
initializers:[Tensor];
inputs:[Input];
quant_infos:[QuantInfo];
outputs:[string];
}

root_type Model;
13 changes: 13 additions & 0 deletions dnnlibrary/src/DaqReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ void AddInputs(const DNN::Model &model, ModelBuilder &builder) {
}
}

void AddOutputs(const DNN::Model &model, ModelBuilder &builder) {
using namespace android::nn::wrapper;
if (model.outputs() == nullptr) {
return;
}
for (const auto &output : *model.outputs()) {
PNT(output->str());
css output_name = output->str();
builder.AddOutput(output_name);
}
}

void AddLayers(const DNN::Model &model, ModelBuilder &builder) {
for (const auto layer : *model.layers()) {
switch (layer->type()) {
Expand Down Expand Up @@ -359,5 +371,6 @@ void ReadDaqImpl(const uint8_t *buf, ModelBuilder &builder) {
AddInitializersFromBuffer(*model, builder);
AddInputs(*model, builder);
AddLayers(*model, builder);
AddOutputs(*model, builder);
}
} // namespace dnn
Loading

0 comments on commit 90cb0f8

Please sign in to comment.