From a1d858c5028c1a26d37286913d64028849454b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Do=C5=82bniak?= Date: Wed, 18 Nov 2020 20:27:51 +0100 Subject: [PATCH] Remove the assert that could terminate the process, throw an exception instead (#3205) --- ngraph/test/util/engine/interpreter_engine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ngraph/test/util/engine/interpreter_engine.cpp b/ngraph/test/util/engine/interpreter_engine.cpp index 6c80429b29a..4b7e9b80471 100644 --- a/ngraph/test/util/engine/interpreter_engine.cpp +++ b/ngraph/test/util/engine/interpreter_engine.cpp @@ -98,7 +98,10 @@ namespace // TODO: add testing infrastructure for float16 and bfloat16 to avoid cast to double std::vector expected_double(expected.size()); std::vector result_double(result.size()); - assert(expected.size() == result.size() && "expected and result size must match"); + + NGRAPH_CHECK(expected.size() == result.size(), + "Number of expected and computed results don't match"); + for (int i = 0; i < expected.size(); ++i) { expected_double[i] = static_cast(expected[i]); @@ -107,7 +110,7 @@ namespace return ngraph::test::all_close_f(expected_double, result_double, tolerance_bits); } -}; +}; // namespace test::INTERPRETER_Engine::INTERPRETER_Engine(const std::shared_ptr function) : m_function{function}