-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Relay][Pass] Avoid FoldConstant folding some ops #4245
Conversation
60c8508
to
310b3a3
Compare
@vinx13 BTW, we do expect constant folding for integer values, right? |
@zhiics Do you mean scalar values? |
@vinx13 I actually meant both scalar and |
The ops skipped all initialize tensors with scalar value. Is there any use cases we want to actually create these tensors as constant? |
yeah, I am not aware of such a use case. I was curious because I thought it was a rounding problem, but integer values would not have it. Could you explain a bit more why we need to keep those operators? If so, should we also keep |
This is mostly performance issue. For example, |
I see. Thanks. |
Thanks @vinx13 @anijain2305 This is now merged. |
We should make this configurable, this is good for some use cases but hardwiring this set of ops for other use cases doesn't make sense, for example in the VM it is better to manifest these as constants and load into constant pool then doing it at runtime. |
Yeah, Jared is right. I was hesitating on this as well. @vinx13 Can you send another PR to make it configurable? Sorry for the inconvenience. |
This PR basically extends the rule in |
* [Relay][Pass] Avoid FoldConstant folding some ops * rename
Add a list of ops that should be constant evaluated. Current use case is fixed point multiplication (with TONEAREST rounding mode), which generate constant tensor for rounding. Ideally we expect it to an inlined scalar.
@anijain2305 @zhiics