From 50e6d0e31e056a0c705244b9fbd92d1660830858 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Mon, 2 Nov 2020 19:34:06 -0800 Subject: [PATCH] Added check in hello sample (#2896) * Added check in hello sample * move check before inference --- inference-engine/samples/classification_sample_async/main.cpp | 2 +- inference-engine/samples/hello_classification/main.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/inference-engine/samples/classification_sample_async/main.cpp b/inference-engine/samples/classification_sample_async/main.cpp index b8cf5a035d5..2a20eb56e26 100644 --- a/inference-engine/samples/classification_sample_async/main.cpp +++ b/inference-engine/samples/classification_sample_async/main.cpp @@ -98,6 +98,7 @@ int main(int argc, char *argv[]) { // ----------------------------------------------------------------------------------------------------- // --------------------------- 3. Configure input & output --------------------------------------------- + if (network.getOutputsInfo().size() != 1) throw std::logic_error("Sample supports topologies with 1 output only"); // --------------------------- Prepare input blobs ----------------------------------------------------- slog::info << "Preparing input blobs" << slog::endl; @@ -214,7 +215,6 @@ int main(int argc, char *argv[]) { // --------------------------- 8. Process output ------------------------------------------------------- slog::info << "Processing output blobs" << slog::endl; OutputsDataMap outputInfo(network.getOutputsInfo()); - if (outputInfo.size() != 1) throw std::logic_error("Sample supports topologies with 1 output only"); Blob::Ptr outputBlob = inferRequest.GetBlob(outputInfo.begin()->first); /** Validating -nt value **/ diff --git a/inference-engine/samples/hello_classification/main.cpp b/inference-engine/samples/hello_classification/main.cpp index 974aa0de754..048f3b0451b 100644 --- a/inference-engine/samples/hello_classification/main.cpp +++ b/inference-engine/samples/hello_classification/main.cpp @@ -86,6 +86,7 @@ int main(int argc, char *argv[]) { // 2. Read a model in OpenVINO Intermediate Representation (.xml and .bin files) or ONNX (.onnx file) format CNNNetwork network = ie.ReadNetwork(input_model); + if (network.getOutputsInfo().size() != 1) throw std::logic_error("Sample supports topologies with 1 output only"); network.setBatchSize(1); // -----------------------------------------------------------------------------------------------------