Skip to content
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

[CherryPick] Inductor cpp wrapper: fix dtype of ShapeAsConstantBuffer (#122297) #123064

Merged
merged 1 commit into from Apr 2, 2024

Conversation

chunyuan-w
Copy link
Collaborator

@chunyuan-w chunyuan-w commented Apr 1, 2024

Cherry-pick #122297 to release/2.3 to fix the regression of Inductor CPP wrapper dynamic shape inference against 2.2 (#122292).

For at::scalar_tensor the default dtype will be float (link to scalar_tensor, link to default dtype) 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

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler @amjames @desertfire @chauhang

)

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
Copy link

pytorch-bot bot commented Apr 1, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/123064

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 0542353 with merge base 86a2d67 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@atalman atalman merged commit 857797d into pytorch:release/2.3 Apr 2, 2024
149 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants