altanh commented on pull request #7731: URL: https://github.com/apache/tvm/pull/7731#issuecomment-806019388
> I think I agree that merging these with SimplifyExpr would be a win in terms of our ability to control the order of execution. > > On the simplification of things like `x * const(0)`, you can get the ndarray out of the const as ConstantNode->data, and then you can pass that to [this utility](https://github.com/apache/tvm/blob/63d8e97dfbe046e70c91c72cbbf7da8646824217/src/relay/transforms/pattern_utils.h#L385), which will return a `long double` version of the value, which shouldn't loose precision for any of the 64 bit or smaller datatypes we use. You can then do your comparison in a single dtype. > > I've been meaning to implement this for like 6 months, and I haven't had a strong enough forcing function to bubble it up to the top of my priority list. This is just what I needed, thanks! I think since I'm also just checking 0 or 1, there should be no problem casting since the floating point repr should all be the same. I'll fix the Windows issue, it was because I overloaded the same name too much. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
