torch.var_mean and torch.std_mean fail in to_edge: aten.var_mean.correction is not core ATen and has no core decomposition
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend, machine-learning
Direzione di ricerca
Start by reading _default_decomposition_table and the handling of core_aten_decompositions() in ExecuTorch’s decomposition path; the issue identifies the missing var_mean.correction decomposition. Check how existing decompositions map operators to lowerable ATen ops, then verify torch.var_mean and torch.std_mean on the portable and XNNPACK paths, including the dimensions and correction cases described. Done means both export through to_edge and match eager outputs.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🐛 Describe the bug
A model that calls torch.var_mean or torch.std_mean exports fine with torch.export, but to_edge rejects it. This happens on both the portable path and with the XNNPACK partitioner:
import torch
from executorch.exir import to_edge
class M(torch.nn.Module):
def forward(self, x):
return torch.var_mean(x, dim=1, correction=0)
ep = torch.export.export(M(), (torch.randn(3, 7),))
to_edge(ep).to_executorch()
torch._export.verifier.SpecViolationError:
Operator torch._ops.aten.var_mean.correction is not in Core ATen opset (https://pytorch.org/docs/stable/torch.compiler_ir.html#core-aten-ir)."
torch.std_mean(x, dim=1) fails the same way.
torch.var_mean exports to aten.var_mean.correction. aten.var_mean.dim and aten.std_mean.correction also decompose to it. It isn't a core ATen op, and core_aten_decompositions() has no entry for it, so run_decompositions() leaves it in the graph. Its only registered decomposition is the torch._refs one, which produces prims ops. So adding it to additional_decomp_ops in _default_decomposition_table (as for linalg_vector_norm) only moves the failure to RuntimeError: Missing out variants: {'prims::var', 'prims::sum', 'prims::div'}.
Decomposing it to aten.var.correction and aten.mean.dim in _default_decomposition_table makes both ops lower and run on the portable and XNNPACK paths, with outputs matching eager, for dim=None, keepdim=True, a default and an explicit correction, and torch.std_mean(..., unbiased=False). I'll open a PR with that.
Versions
executorch 1.5.1 (_default_decomposition_table is the same on main at f2575be), torch 2.14.1+cpu, Python 3.12, Linux x86_64 (WSL2).
cc @JacobSzwejbka @angelayi
- Lingua principale
- Python
- Stelle
- 5.1k
- Fork
- 1.2k
- Merge medio
- 2g 8h
- PR unite (30g)
- 610
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 pytorch/executorch
-
Portable remainder kernel: wrong sign for integers and float64 rounded to floatForse già presa @JakeStevens l’ha presa oggi. Apertabug module: kernels triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
pytorch/executorch#23682 · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement triaged
Difficoltà 2/5 Mezza giornata Idoneità per principianti 68/100
pytorch/executorch#21640 ·
I maintainer di solito rispondono entro 1 giorno
-
Feedback about ToolsApertainvalid module: doc
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
pytorch/executorch#23706 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Portable floor_divide returns non-whole numbers for floats and wrong values for a zero divisorForse già presa @JakeStevens l’ha presa 1 giorno fa. Apertabug module: kernels
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
pytorch/executorch#23684 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Prompts of max_seq_len tokens fail to prefill: export_llm bounds the KV-cache token input at max_seq_len - 1 but publishes get_max_seq_len = max_seq_lenForse già presa @alpharomercoma l’ha presa 3 giorni fa. Apertabug module: extension module: llm triaged
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
pytorch/executorch#23678 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pytorch/executorch
Issue simili
-
effort: low prio: low ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
digitalfabrik/integreat-cms#4616 ·
I maintainer di solito rispondono entro 5 giorni
-
bug difficulty:2 good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
MakazhanAlpamys/Soup#1865 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
FinanceFlash/unvibecode#233 ·
I maintainer di solito rispondono entro 1 giorno
-
area: agents area: docs good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openapi/gknowledge#23 ·
-
useless-suppression reported for deprecated-* messages that should be exemptForse già presa @adityasinha-ghub l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
pylint-dev/pylint#11656 ·
I maintainer di solito rispondono entro 1 giorno