Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

torch.var_mean and torch.std_mean fail in to_edge: aten.var_mean.correction is not core ATen and has no core decomposition

Aperta
#23,680 0 commenti 0 reazioni 2 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@usmanmateen ci sta già lavorando.

Dal 12/10/2026.

  • #23681 di @usmanmateen — aperta

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
Stack tecnologico
python, pytorch

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

bug module: exir triaged
🐛 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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pytorch/executorch

Tutte le issue di pytorch/executorch

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.