-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Disallow overriding initializers if IR version < 4 #1324
Conversation
Remove unused member
should the model file named .pb like others in the folder? #ByDesign Refers to: onnxruntime/test/testdata/optional_inputs_ir3.onnx:1 in f54e356. [](commit_id = f54e356, deletion_comment = False) |
The general pattern is to use .onnx for a model and .pb for test input/expected output. As these are models .onnx seemed more appropriate (and provides a signal you could view it in something like netron if you wanted). In reply to: 507772523 [](ancestors = 507772523) Refers to: onnxruntime/test/testdata/optional_inputs_ir3.onnx:1 in f54e356. [](commit_id = f54e356, deletion_comment = False) |
netron seems to treat both .pb and .onnx as onnx models. I think what you said is good to differentiate .onnx and .pb, for model and tensor separately. We may have a separate PR later to rename the .pb models in this folder. In reply to: 507870064 [](ancestors = 507870064,507772523) Refers to: onnxruntime/test/testdata/optional_inputs_ir3.onnx:1 in f54e356. [](commit_id = f54e356, deletion_comment = False) |
I'll go over them later today to cleanup in a separate PR In reply to: 507903578 [](ancestors = 507903578,507870064,507772523) Refers to: onnxruntime/test/testdata/optional_inputs_ir3.onnx:1 in f54e356. [](commit_id = f54e356, deletion_comment = False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: Disallow overriding an initializer via a graph input if the IR version is < 4. This enforces an implicit assumption that initializers should be treated as constant, and allows constant folding to be done on a model with an older IR version. Separate constant and overridable initializers so that it's clear which ones constant folding can utilize. Update Graph to not add all initializers to the graph inputs when the graph is manually created (i.e. not loaded from a GraphProto) and the IR version is >= 4. Motivation and Context In order to do constant folding we need to know which initializers can be treated as constant and which are overridable. All initializers were required to have a matching graph input prior to IR version 4, technically making all of them overridable. The intention however was for them to be treated as constants, and this change enforces that intent. The benefit of doing so is that constant folding will work for models with IR version < 4. The cost is that if someone is actually overriding an initializer they will need to update the IR version of their model to version 4 in order to keep doing so. The belief is that this is a very small subset of usage (e.g. models involving feeding in a truncated sequence) and the cost to update that small subset is warranted by the benefit of constant folding being able to be enabled on all older models without them needing an IR version update.
Description: Disallow overriding an initializer via a graph input if the IR version is < 4. This enforces an implicit assumption that initializers should be treated as constant, and allows constant folding to be done on a model with an older IR version. Separate constant and overridable initializers so that it's clear which ones constant folding can utilize. Update Graph to not add all initializers to the graph inputs when the graph is manually created (i.e. not loaded from a GraphProto) and the IR version is >= 4. Motivation and Context In order to do constant folding we need to know which initializers can be treated as constant and which are overridable. All initializers were required to have a matching graph input prior to IR version 4, technically making all of them overridable. The intention however was for them to be treated as constants, and this change enforces that intent. The benefit of doing so is that constant folding will work for models with IR version < 4. The cost is that if someone is actually overriding an initializer they will need to update the IR version of their model to version 4 in order to keep doing so. The belief is that this is a very small subset of usage (e.g. models involving feeding in a truncated sequence) and the cost to update that small subset is warranted by the benefit of constant folding being able to be enabled on all older models without them needing an IR version update.
Description:
Motivation and Context
In order to do constant folding we need to know which initializers can be treated as constant and which are overridable. All initializers were required to have a matching graph input prior to IR version 4, technically making all of them overridable. The intention however was for them to be treated as constants, and this change enforces that intent.
The benefit of doing so is that constant folding will work for models with IR version < 4. The cost is that if someone is actually overriding an initializer they will need to update the IR version of their model to version 4 in order to keep doing so. The belief is that this is a very small subset of usage (e.g. models involving feeding in a truncated sequence) and the cost to update that small subset is warranted by the benefit of constant folding being able to be enabled on all older models without them needing an IR version update.