Specialized exception if ONNX model is unsupported (#7234)
* Add tests * Add new error throw
This commit is contained in:
parent
81c8cd711b
commit
a81164e1cb
@ -254,8 +254,9 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
|
||||
auto ngFunc = FE->convert(inputModel);
|
||||
return CNNNetwork(ngFunc, exts);
|
||||
}
|
||||
IE_THROW() << "Unknown model format! Cannot find reader for model format: " << fileExt
|
||||
<< " and read the model: " << modelPath << ". Please check that reader library exists in your PATH.";
|
||||
IE_THROW(NetworkNotRead) << "Unable to read the model: " << modelPath
|
||||
<< " Please check that model format: " << fileExt
|
||||
<< " is supported and the model is correct.";
|
||||
}
|
||||
|
||||
CNNNetwork details::ReadNetwork(const std::string& model,
|
||||
@ -288,8 +289,8 @@ CNNNetwork details::ReadNetwork(const std::string& model,
|
||||
return CNNNetwork(ngFunc, exts);
|
||||
}
|
||||
|
||||
IE_THROW() << "Unknown model format! Cannot find reader for the model and read it. Please check that reader "
|
||||
"library exists in your PATH.";
|
||||
IE_THROW(NetworkNotRead)
|
||||
<< "Unable to read the model. Please check if the model format is supported and model is correct.";
|
||||
}
|
||||
|
||||
} // namespace InferenceEngine
|
||||
|
@ -47,7 +47,7 @@ TEST(ONNXReader_ModelSupported, scrambled_keys) {
|
||||
TEST(ONNXReader_ModelUnsupported, no_graph_field) {
|
||||
// this model contains only 2 fields (it doesn't contain a graph in particular)
|
||||
EXPECT_THROW(InferenceEngine::Core{}.ReadNetwork(model_path("unsupported/no_graph_field.onnx")),
|
||||
InferenceEngine::Exception);
|
||||
InferenceEngine::NetworkNotRead);
|
||||
}
|
||||
|
||||
TEST(ONNXReader_ModelUnsupported, incorrect_onnx_field) {
|
||||
@ -55,11 +55,11 @@ TEST(ONNXReader_ModelUnsupported, incorrect_onnx_field) {
|
||||
// this test will have to be changed if the number of fields in onnx.proto
|
||||
// (ModelProto message definition) ever reaches 31 or more
|
||||
EXPECT_THROW(InferenceEngine::Core{}.ReadNetwork(model_path("unsupported/incorrect_onnx_field.onnx")),
|
||||
InferenceEngine::Exception);
|
||||
InferenceEngine::NetworkNotRead);
|
||||
}
|
||||
|
||||
TEST(ONNXReader_ModelUnsupported, unknown_wire_type) {
|
||||
// in this model the graph key contains wire type 7 encoded in it - this value is incorrect
|
||||
EXPECT_THROW(InferenceEngine::Core{}.ReadNetwork(model_path("unsupported/unknown_wire_type.onnx")),
|
||||
InferenceEngine::Exception);
|
||||
InferenceEngine::NetworkNotRead);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user