-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Labels
Description
Describe the bug
After upgrading to PyTorch 2.8.0, compilation involving LabelTensor fails due to incorrect inference of runtime_type in the torch compilation pipeline. This results in a RuntimeError during the backward pass.
To Reproduce
Upgrade to PyTorch 2.8.0 and run:
pytest tests/test_solver/test_pinn.pyYou might also want to upgrade torchvision.
Expected behavior
All tests should pass successfully, and compilation should handle LabelTensor without metadata mismatches.
Output
RuntimeError:
E During the backward, we encountered a tensor subclass where we guessed its
E metadata incorrectly.
E
E Expected metadata: None, expected type: <class 'torch.Tensor'>
E
E Runtime metadata: None, runtime type: <class 'pina.label_tensor.LabelTensor'>
E
E shape: torch.Size([1, 1])
E To fix this, your tensor subclass must implement the dunder method __force_to_same_metadata__.Additional context
- Implementing
__force_to_same_metadata__inLabelTensordid not resolve the issue. - This might be related to changes introduced in the compilation pipeline in PyTorch 2.8.
- The issue was not observed in PyTorch 2.7.x.