8000 Fixing gpu cpu inconsistency by bigachin · Pull Request #153331 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Fixing gpu cpu inconsistency #153331

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bigachin
Copy link

Fixes #153312

Fixes a discrepancy in torch.nn.functional.lp_pool1d between CPU and GPU behavior when given extreme values for kernel_size or norm_type.

Before this fix:

On CPU: invalid inputs would return a tensor of zeros silently without error.
On GPU: the same inputs correctly raised a RuntimeError.

Now:
Adds validation in lp_pool1d to raise a ValueError for extreme kernel_size or norm_type.
Ensures consistent behavior across CPU and GPU implementations.
Tests added in test/test_nn.py:

test_lp_pool1d_invalid_params: checks that invalid CPU inputs raise ValueError.
test_lp_pool1d_invalid_params_gpu: calls the backend op directly to confirm that invalid GPU inputs raise RuntimeError.

Copy link
pytorch-bot bot commented May 10, 2025

🔗 Helpful Links

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

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

❌ 19 New Failures, 1 Unrelated Failure

As of commit 32760fb with merge base e4f2282 (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot pytorch-bot bot added the release notes: nn release notes category label May 10, 2025
@albanD albanD removed their request for review May 12, 2025 14:45
@colesbury colesbury added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open source release notes: nn release notes category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lp_pool1d behavior inconsistency between CPU and GPU
3 participants
0