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] Added decomposition for upsample_nearest_exact Nd #113749
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/113749
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a7cf034 with merge base 115da02 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@voznesenskym added you as reviewer due to the inductor/lowering, but please reassign if there is a better reviewer |
@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 |
Fixed #116848 Related to the bug introduced in my previous PR here: https://github.com/pytorch/pytorch/pull/113749/files#diff-a1b077971cddfabfa0071c5162265066e867bc07721816d95b9cbe58431c38e3R3264 Originally, the code was ```python def upsample_nearestnd( x, output_size, scales_x: Tuple[Optional[float], ...], n: int = 2, exact: bool = False, ): # ... scales = [i / o for i, o in zip(i_sizes, o_sizes)] for i, scale in enumerate(scales): if scale: scales[i] = scale ``` which is wrong as `scales_x` is not used but can be provided by the user. The code was working for cases when user provided scale value can be recomputed using `input / output` sizes, e.g. scale=2.0. However, this would fail if input scale is a float value, e.g. 2.3, in this case recomputed scale is a bit different (e.g. 2.292682926829268, depending on input and output size) and can lead to an inconsistent output. This problem was "fixed" to the following in my previous PR: #113749 ```python def upsample_nearestnd( x, output_size, scales_x: Tuple[Optional[float], ...], n: int = 2, exact: bool = False, ): # ... scales = [i / o for i, o in zip(i_sizes, o_sizes)] for i, scale in enumerate(scales_x): if scale: scales[i] = scale ``` however, this leads to a wrong scale value as it should be inverted as (1 / scale). Pull Request resolved: #117538 Approved by: https://github.com/peterbell10
Description:
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler