Skip to content

Commit

Permalink
Fixed problem with model_inputs method in ONNX Editor (openvinotoolki…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Bencer authored and rnugmanx committed Aug 26, 2021
1 parent 0114fc9 commit f6d4a5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ngraph/frontend/onnx/onnx_import/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ std::vector<std::string> onnx_editor::ONNXModelEditor::model_inputs() const
{
const auto& graph = m_pimpl->m_model_proto->graph();
std::vector<std::string> inputs;
inputs.reserve(graph.input_size() - graph.initializer_size());
for (const auto& in : graph.input())
{
// ignore inputs which are initializers
if (std::find_if(graph.initializer().begin(),
graph.initializer().end(),
[&in](const TensorProto& initializer) {
Expand Down
9 changes: 9 additions & 0 deletions ngraph/test/onnx/onnx_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,15 @@ NGRAPH_TEST(onnx_editor, model_inputs)
EXPECT_TRUE(inputs == (std::vector<std::string>{"in1", "in2", "in3"})); // in4 is initializer
}

NGRAPH_TEST(onnx_editor, model_inputs_with_non_input_initializers)
{
ONNXModelEditor editor{file_util::path_join(
SERIALIZED_ZOO, "onnx/instance_norm_dynamic.prototxt")};

const auto inputs = editor.model_inputs();
EXPECT_TRUE(inputs == (std::vector<std::string>{"input"}));
}

NGRAPH_TEST(onnx_editor, model_output)
{
ONNXModelEditor editor{file_util::path_join(
Expand Down

0 comments on commit f6d4a5b

Please sign in to comment.