-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add shape inference for Expand using symbolic shape input #3789
Conversation
8477204
to
1985178
Compare
Signed-off-by: Joe <joe@preferred.jp>
1985178
to
401d6c4
Compare
d361898
to
df0129c
Compare
#3807 also adds rank inference as fallback. It is much simpler can you please check. Thanks! |
Signed-off-by: Joe <joe@preferred.jp>
Signed-off-by: Joe <joe@preferred.jp>
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.
LGTM. Thank you!
LGTM, thanks! A minor comment: I think we would want to use the same logic for any input that denotes a shape (in any op). So, extracting this as a generic utility may be useful. Eg., a function like:
|
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.
LGTM. Added a minor suggestion.
Thank you for the suggestion. I have a question about the implementation. |
Good question! Your suggestion is fine, but I think we will need to return a boolean value to indicate whether a value was found or not. I think this case is not being handled correctly by the existing code, so it probably needs to be fixed anyway. I think the existing code uses the default value assigned to |
@gramalingam Sorry for late response! I implemented |
e8a49ed
to
ebb71d3
Compare
Signed-off-by: Joe <joe@preferred.jp>
1234d52
to
b54c75b
Compare
Hi @xuzijian629 : thanks for the update! Would it be possible to fix the conflicts, so we can merge this in? Thanks! |
Hi @gramalingam, memo: 37ae312 returns early if symbolic input does not have dim_value. In such case, |
Great, thanks very much @xuzijian629 |
@gramalingam Could you please sign-off approval for this PR again and let's merge this one? Thanks! |
* Infer expand by shape input Signed-off-by: Joe <joe@preferred.jp> * Add test Signed-off-by: Joe <joe@preferred.jp> * Fix comments Signed-off-by: Joe <joe@preferred.jp> * Generalize to getShapeInput function Signed-off-by: Joe <joe@preferred.jp> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com>
* Infer expand by shape input Signed-off-by: Joe <joe@preferred.jp> * Add test Signed-off-by: Joe <joe@preferred.jp> * Fix comments Signed-off-by: Joe <joe@preferred.jp> * Generalize to getShapeInput function Signed-off-by: Joe <joe@preferred.jp> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com>
Description
Even when the shape input is not available as an initializer, we can infer the output shape using symbolic shape input.
Motivation
Existing shape inference cannot infer
dim_value
in some case like