Skip to content

Commit 90cb0f8

Browse files
authored
Merge pull request #57 from JDAI-CV/support_onnx_model_output
support onnx model output
2 parents 99baa7b + a75548d commit 90cb0f8

6 files changed

Lines changed: 231 additions & 106 deletions

File tree

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ IndentWidth: 4
33
AllowShortBlocksOnASingleLine: false
44
AllowShortLoopsOnASingleLine: false
55
AllowShortFunctionsOnASingleLine: false
6+
AlignEscapedNewlines: Left

common/daq.fbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ table Model {
190190
initializers:[Tensor];
191191
inputs:[Input];
192192
quant_infos:[QuantInfo];
193+
outputs:[string];
193194
}
194195

195196
root_type Model;

dnnlibrary/src/DaqReader.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ void AddInputs(const DNN::Model &model, ModelBuilder &builder) {
177177
}
178178
}
179179

180+
void AddOutputs(const DNN::Model &model, ModelBuilder &builder) {
181+
using namespace android::nn::wrapper;
182+
if (model.outputs() == nullptr) {
183+
return;
184+
}
185+
for (const auto &output : *model.outputs()) {
186+
PNT(output->str());
187+
css output_name = output->str();
188+
builder.AddOutput(output_name);
189+
}
190+
}
191+
180192
void AddLayers(const DNN::Model &model, ModelBuilder &builder) {
181193
for (const auto layer : *model.layers()) {
182194
switch (layer->type()) {
@@ -359,5 +371,6 @@ void ReadDaqImpl(const uint8_t *buf, ModelBuilder &builder) {
359371
AddInitializersFromBuffer(*model, builder);
360372
AddInputs(*model, builder);
361373
AddLayers(*model, builder);
374+
AddOutputs(*model, builder);
362375
}
363376
} // namespace dnn

0 commit comments

Comments
 (0)