SIGN IN SIGN UP

Fix symbolic FakeTensor support for shift out overloads (#194375)

## Problem

The functional shift operators had Python Meta implementations, but their autogenerated `out=` overloads did not. This breaks Inductor eager-backend lowering when a functional shift is rewritten to its out= overload: symbolic FakeTensor propagation fails before generated code can run.

The autogenerated composite `out=` kernel in `torchgen/native_function_generation.py` calls `resize_out_helper -> at::native::resize_output(dst, src.sizes())`, and `sizes()` throws when called on a tensor with symbolic sizes.

## Fix

Register Python Meta implementations for the `__lshift__` and `__rshift__` `Scalar_out` and `Tensor_out` overloads, reusing the existing shift metadata logic and out_wrapper(exact_dtype=True). This preserves the native CPU/CUDA implementations while enabling symbolic metadata propagation and matching the native output-dtype contract. Regression tests cover symbolic left/right shifts with scalar and tensor operands, as well as dtype validation.

## Test Plan

```
    ./.venv/bin/python test/test_meta.py -k shift_out
    ./.venv/bin/python test/test_decomp.py HasDecompTest.test_has_decomposition
```

Both tests passed. `spin quicklint` could not initialize lintrunner because `uvx lintrunner@0.12.7` init failed.

## AI disclosure

This commit was authored with assistance from an AI assistant.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/194375
Approved by: https://github.com/Skylion007
L
Lucas Bordeaux committed
445878d0895d435f1e57e1228594fd1384b5fa92
Parent: 84c32f8
Committed by PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> on 8/24/2026, 2:21:45 PM