MasterJH5574 opened a new pull request, #13789:
URL: https://github.com/apache/tvm/pull/13789
This PR fixes a bug of IndexDataTypeNormalizer that is used by
CreatePrimFunc.
#13449 enhanced the normalizer by unwrapping unnecessary casts, by the rule
that “if the value to be casted already has the target index dtype`, the cast
will be omitted. However, there are cases where a cast here is for other
purpose. Like in image resize operators, there are sometimes rounding operation
for indices, like
```python
T.Cast("int64", T.round(T.float32(128) / T.Cast("float32", oh) *
T.Cast("float32", v_i2), dtype="float32"))
```
is used as a final index. Note that this PrimExpr contains casts that
directly operated on indices, such as `T.Cast("float32", oh)`. This cast is for
division purpose, in order to have floating point division result. As a result,
it is not expected to unwrap such casts, while the previous implementation did
remove the casts.
Therefore, this PR patches this issue by only unwrapping the casts whose
target dtype is integer dtype.
cc @vinx13 @tqchen
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]