Skip to content

Remove deprecated expectedFailurePropagateRealTensors decorator from FakeTensorOperatorInvariants test#3199

Open
tszulist-hbn wants to merge 1 commit intointel:mainfrom
tszulist-hbn:dev/tszulist/issue-2712
Open

Remove deprecated expectedFailurePropagateRealTensors decorator from FakeTensorOperatorInvariants test#3199
tszulist-hbn wants to merge 1 commit intointel:mainfrom
tszulist-hbn:dev/tszulist/issue-2712

Conversation

@tszulist-hbn
Copy link
Copy Markdown
Contributor

Fixes #2712 together with the corresponding change to PyTorch: pytorch/pytorch#178584

Fix test_module_to failure with weakref error on XPU

Fixes #2712

Summary

Fixes RuntimeError: Cannot swap t2 because it has weakref associated with it in FakeTensorOperatorInvariants.test_module_to when running on XPU. The error occurs when calling Module.to() under FakeTensorMode because swap_tensors fails due to weakrefs held on the applied parameter tensor.

The upstream fix is tracked in pytorch/pytorch#171856.

Changes

  • Updated test/xpu/test_fake_tensor_xpu.py to align with the upstream PyTorch test changes that make test_module_to and related FakeTensor tests device-generic (supporting both CUDA and XPU).

Copilot AI review requested due to automatic review settings March 27, 2026 09:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the deprecated expectedFailurePropagateRealTensors marking on FakeTensorOperatorInvariants.test_module_to so the test runs (and passes) under the propagate-real-tensors configuration, aligning with upstream PyTorch changes and fixing the XPU weakref swap failure.

Changes:

  • Dropped the expectedFailurePropagateRealTensors decorator from test_module_to in the XPU FakeTensor test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[upstream_ut] RuntimeError: Cannot swap t2 because it has weakref associated with it ; RuntimeError: _apply(): Co

2 participants