Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Demo] Demo how to bump opset version after ONNX release #4134

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions onnx/defs/operator_sets.h
Expand Up @@ -1025,6 +1025,16 @@ class OpSet_Onnx_ver16 {
fn(GetOpSchema<ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, PRelu)>());
}
};

// Forward declarations for ai.onnx version 17

// Iterate over schema from ai.onnx version 17
class OpSet_Onnx_ver17 {
public:
static void ForEachSchema(std::function<void(OpSchema&&)> fn) {
}
};

inline void RegisterOnnxOperatorSetSchema() {
RegisterOpSetSchema<OpSet_Onnx_ver1>();
RegisterOpSetSchema<OpSet_Onnx_ver2>();
Expand All @@ -1042,13 +1052,15 @@ inline void RegisterOnnxOperatorSetSchema() {
RegisterOpSetSchema<OpSet_Onnx_ver14>();
RegisterOpSetSchema<OpSet_Onnx_ver15>();
RegisterOpSetSchema<OpSet_Onnx_ver16>();
RegisterOpSetSchema<OpSet_Onnx_ver17>();
// 0 means all versions of ONNX schema have been loaded
OpSchemaRegistry::Instance()->SetLoadedSchemaVersion(0);
}

inline void RegisterOnnxOperatorSetSchema(int target_version) {
// Update here if opset_version bumps
// These calls for schema registration here are required to be in descending order for this to work correctly
RegisterOpSetSchema<OpSet_Onnx_ver17>(target_version);
RegisterOpSetSchema<OpSet_Onnx_ver16>(target_version);
RegisterOpSetSchema<OpSet_Onnx_ver15>(target_version);
RegisterOpSetSchema<OpSet_Onnx_ver14>(target_version);
Expand Down
2 changes: 1 addition & 1 deletion onnx/defs/schema.h
Expand Up @@ -994,7 +994,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
// Increase the highest version when you make BC-breaking changes to the
// operator schema on specific domain. Update the lowest version when it's
// determined to remove too old version history.
map_[ONNX_DOMAIN] = std::make_pair(1, 16);
map_[ONNX_DOMAIN] = std::make_pair(1, 17);
map_[AI_ONNX_ML_DOMAIN] = std::make_pair(1, 3);
map_[AI_ONNX_TRAINING_DOMAIN] = std::make_pair(1, 1);
// ONNX's preview domain contains operators subject to change, so
Expand Down