pytorch
e5b7c7a0 - Fix torchinductor uint8 bug (#101468)

Commit
1 year ago
Fix torchinductor uint8 bug (#101468) Fixes #96604 ## Issue description When we use a constant tensor with a uint8 type, the kernel generated by torchinductor output wrong results. For example, the negative value of `5` in uint8 will be `255`, and it is `True` that `255` is larger than `5`. However, the output result is `False` when we compare `torch.neg(5)` with `5`. It is because torchinductor bypass the data type for constant tensors and the `5` here is taken as a int32. Then, the comparison is between `-5` with `5`. ## Solution This PR generates an extra conversion for uint8 constant value when we use it. it does not occur on the first assignment but the access for this constant value. Pull Request resolved: https://github.com/pytorch/pytorch/pull/101468 Approved by: https://github.com/desertfire, https://github.com/jansel
Author
Committer
Parents
Loading