Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de 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

Abierto
#23,680 0 comentarios 0 reacciones 2 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@usmanmateen ya está trabajando en esto.

Desde el 12/10/2026.

  • #23681 de @usmanmateen — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, pytorch

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Python
Estrellas
5.1k
Forks
1.2k
Merge medio
2 d 8 h
PR fusionados (30 d)
610

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pytorch/executorch

Todos los issues de pytorch/executorch

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.