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
Inductor cpp wrapper: fix dtype of ShapeAsConstantBuffer #122297
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/122297
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit ab42345 with merge base 6502c88 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: fefdca5e4d66873bdf3c5519cef9cbaa5263ef74 Pull Request resolved: #122297
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
ghstack-source-id: e19c495456e5649156745577281628076878e4d9 Pull Request resolved: #122297
For `at::scalar_tensor` the default dtype will be `float` ([link to scalar_tensor](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/aten/src/ATen/native/TensorFactories.cpp#L856), [link to default dtype](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/c10/core/TensorOptions.h#L551)) if we don't set the `dtype` value. However, the input scalar value is not necessarily a `float` value. With `torch::tensor(x)`, the dtype of the tensor will be decided according to the dtype of the scalar. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler amjames desertfire chauhang [ghstack-poisoned]
ghstack-source-id: 42a8a0537bff727c38f82af6e0aebe0707e5e09b Pull Request resolved: #122297
@desertfire I just noticed that #118024 changed |
It is related to https://github.com/pytorch/pytorch/pull/118024/files/bba213c151f2c8e7a29635d273a73a6c98d24393#r1463364631. |
Considering an int scalar value I tried to get the dtype of the scalar value and pass it to |
Hi @desertfire this issue will cause regression against the PyTorch 2.2 release and we're trying to see if it's possible to fix it in 2.3. May I know if you have other suggestions regarding the current fix approach? |
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.
ok for the non abi-compatible mode, although we will have to come back to fix once I turned on the abi-compatible mode as default.
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Oh okay. Btw, when do we plan to turn on the abi-compatible mode as default? |
) For `at::scalar_tensor` the default dtype will be `float` ([link to scalar_tensor](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/aten/src/ATen/native/TensorFactories.cpp#L856), [link to default dtype](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/c10/core/TensorOptions.h#L551)) if we don't set the `dtype` value. However, the input scalar value is not necessarily a `float` value. With `torch::tensor(x)`, the dtype of the tensor will be decided according to the dtype of the scalar. Pull Request resolved: pytorch#122297 Approved by: https://github.com/jgong5, https://github.com/desertfire
We do, once its coverage has reached a reasonable level. |
…#122297) (#123064) For `at::scalar_tensor` the default dtype will be `float` ([link to scalar_tensor](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/aten/src/ATen/native/TensorFactories.cpp#L856), [link to default dtype](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/c10/core/TensorOptions.h#L551)) if we don't set the `dtype` value. However, the input scalar value is not necessarily a `float` value. With `torch::tensor(x)`, the dtype of the tensor will be decided according to the dtype of the scalar. Pull Request resolved: #122297 Approved by: https://github.com/jgong5, https://github.com/desertfire
) For `at::scalar_tensor` the default dtype will be `float` ([link to scalar_tensor](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/aten/src/ATen/native/TensorFactories.cpp#L856), [link to default dtype](https://github.com/pytorch/pytorch/blob/0d8e960f74acd359358e0b729c4803d2b71849e5/c10/core/TensorOptions.h#L551)) if we don't set the `dtype` value. However, the input scalar value is not necessarily a `float` value. With `torch::tensor(x)`, the dtype of the tensor will be decided according to the dtype of the scalar. Pull Request resolved: pytorch#122297 Approved by: https://github.com/jgong5, https://github.com/desertfire
Stack from ghstack (oldest at bottom):
For
at::scalar_tensor
the default dtype will befloat
(link to scalar_tensor, link to default dtype) if we don't set thedtype
value. However, the input scalar value is not necessarily afloat
value. Withtorch::tensor(x)
, the dtype of the tensor will be decided according to the dtype of the scalar.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler @amjames @desertfire @chauhang