-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ONNX] Fix issue with absent value in onnx.ConstantOfShape (#3713)
Previously, if the value was absent, this conversion was creating a dense resource of value 0 with shape equal to the result shape, then later re-extracting a splat value. This only works if the shape is statically known, and even when the shape is known, this is completely unnecessary since the value's shape should be `[1]` and not the result shape. This patch simply sets the `splatvalue` to a `torch.constant.float 0.0` when the onnx op's `value` attr is absent, and adds `nullptr` checks to the subsequent conditionals to avoid them in the case where an `attr` is not given. Addresses <nod-ai/SHARK-ModelDev#831>.
- Loading branch information
Showing
2 changed files
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters