mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-20 19:12:24 +00:00
Fix error message for legacy opset (6 and lower) models at model load time (#1147)
* Initial commit * Resolve comments and revert changes in files that are not needed for this change * Single line addition revert * Resolve comments
This commit is contained in:
parent
7316e54153
commit
a863c67ef8
2 changed files with 18 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "core/graph/model.h"
|
||||
#include <memory>
|
||||
#include "core/common/logging/logging.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
|
|
@ -104,7 +105,21 @@ Model::Model(std::unique_ptr<ModelProto> model_proto, const IOnnxRuntimeOpSchema
|
|||
|
||||
std::unordered_map<std::string, int> domain_to_version;
|
||||
for (auto& opSet : model_proto_->opset_import()) {
|
||||
domain_to_version[opSet.domain()] = gsl::narrow_cast<int>(opSet.version());
|
||||
const auto& domain = opSet.domain();
|
||||
const auto version = opSet.version();
|
||||
// empty domain and 'ai.onnx' are equivalent
|
||||
if ((domain.empty() || domain == "ai.onnx") && version < 7) {
|
||||
// TODO: Check if we can upgrade all the current opset 6 models that are being tested
|
||||
// in CI to opset 7 or above
|
||||
LOGS_DEFAULT(WARNING) << "ONNX Runtime only *guarantees* support for models stamped "
|
||||
"with opset version 7 or above for opset domain 'ai.onnx'. "
|
||||
"Please upgrade your model to opset 7 or higher. "
|
||||
"For now, this opset "
|
||||
<< version
|
||||
<< " model may run depending upon legacy support "
|
||||
"of some older opset version operators.";
|
||||
}
|
||||
domain_to_version[domain] = gsl::narrow_cast<int>(version);
|
||||
}
|
||||
|
||||
auto domain_map = schema_registry->GetLatestOpsetVersions(false);
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ TEST(DynamicSliceTest, dynamic_slice_with_negative_axes) {
|
|||
|
||||
OpTester test2 ("DynamicSlice", 1);
|
||||
test2.AddInput <int32_t> ("data", {3,3,3}, {1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10,11,12,13,14,15,16,17,18,
|
||||
19,20,21,22,23,24,25,26,27});
|
||||
10,11,12,13,14,15,16,17,18,
|
||||
19,20,21,22,23,24,25,26,27});
|
||||
test2.AddInput <int32_t> ("starts", {2}, {-3,0});
|
||||
test2.AddInput <int32_t> ("ends", {2}, {-1,2});
|
||||
test2.AddInput <int32_t> ("axes", {2}, {0,2});
|
||||
|
|
|
|||
Loading…
Reference in a new issue