[tensor-shapes] torch.lerp rejects tensor weights and omits their broadcast shape
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
- #5371 di @mangeshraut712 — chiusa senza merge
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend-api-design
Direzione di ricerca
L’issue rimanda a tensor-shapes/pyrefly-torch-stubs/torch-stubs/__init__.pyi vicino alla riga 3689. Leggi la firma di torch.lerp e la sua espressione di shape, poi esegui il repro.py fornito con pyrefly check. Il lavoro è completato quando il peso Tensor viene accettato e la shape inferita del risultato include la sua shape di broadcast, così che l’esempio venga verificato con shape (3, 2).
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the Bug
torch.lerp accepts a Tensor as its weight argument. The weight can also expand the result shape through broadcasting.
The shape stub only accepts float and computes the result shape from input and end.
Minimal reproduction
Save this code as repro.py. Create an empty pyrefly.toml next to it.
import torch
start = torch.zeros(2)
end = torch.ones(2)
weight = torch.full((3, 1), 0.5)
result = torch.lerp(start, end, weight)
assert result.shape == (3, 2)
assert torch.equal(result, torch.full((3, 2), 0.5))
Run:
python repro.py
pyrefly check repro.py
The runtime assertions pass and the process exits with code 0. The type check reports the errors below.
Expected behavior
Accept Tensor weights. Include the weight shape when computing the broadcast result. In this example, the result shape is (3, 2).
Actual behavior
repro.py:6:33: Argument `Tensor[[3, 1]]` is not assignable to parameter `weight` with type `float` in function `torch.lerp` [bad-argument-type]
Environment and current source
- Python 3.13.13 on Linux.
- Pyrefly 1.4.0.
pyrefly-torch-stubs==1.4.0.- PyTorch 2.13.0+cu126.
I also reproduced this with the stub sources from main at e5f077bcb2897dad3d168c45b9b64271fca94db6. The local Pyrefly binary reports pyrefly 1.4.0. I selected the checkout stub package directories with --site-packages-path. The diagnostics above use those current source files.
Current stub source. The current signature declares weight: float and returns Tensor[broadcast(Shape, OtherShape)]. The Tensor-weight case needs a third shape.
- Lingua principale
- Rust
- Stelle
- 7.2k
- Fork
- 578
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di facebook/pyrefly
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
-
google
Difficoltà 3/5 1-2 giorni Idoneità per principianti 57/100
I maintainer di solito rispondono entro 2 giorni
-
pydantic
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
facebook/pyrefly#5410 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
`bad-return` when a `NoReturn` call is in a `finally` blockForse già presa @mangeshraut712 l’ha presa oggi. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di facebook/pyrefly
Issue simili
-
desktop documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
vfarcic/dot-agent-deck#2008 ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
pbakaus/impeccable#1210 ·
I maintainer di solito rispondono entro 1 giorno
-
area: ci priority: P4 ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
shep-pm/shep#1249 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
L: javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dependabot/dependabot-core#16744 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nautechsystems/nautilus_trader#5486 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno