quantize_per_channel and dequantize_per_tensor.tensor abort the process on a float32 scale
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Ambito
- backend, machine-learning
Direzione di ricerca
Read kernels/quantized/cpu/op_quantize.cpp around quantize_per_channel_out and op_dequantize.cpp around dequantize_per_tensor_tensor_args_out; compare their scale handling with dequantize_per_channel. The report includes a Python reproduction using float32 scales and says C++ tests are part of the proposed fix. Done means the affected operations accept float32 scales without aborting and their results match eager; pull request #25874 is already open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🐛 Describe the bug
quantize_per_channel_out (kernels/quantized/cpu/op_quantize.cpp) and dequantize_per_tensor_tensor_args_out (op_dequantize.cpp) require a float64 scale tensor and check it with ET_CHECK_MSG, so a float32 scale aborts the process instead of execute() returning an error. quantize_per_tensor.tensor refuses it too, with InvalidArgument. The eager ops accept float32 scales, and dequantize_per_channel already does. I found this while comparing the runtime's outputs with eager on small exported programs.
import torch
import executorch.kernels.quantized # registers the out variants
from executorch.exir import to_edge
from executorch.runtime import Runtime
scales = torch.tensor([0.1, 0.5, 2.0]) # float32
zero_points = torch.tensor([0, -3, 4])
class M(torch.nn.Module):
def forward(self, t):
return torch.ops.quantized_decomposed.quantize_per_channel(
t, scales, zero_points, 0, -128, 127, torch.int8
)
x = torch.randn(3, 4) * 3
prog = to_edge(torch.export.export(M(), (x,))).to_executorch()
Runtime.get().load_program(prog.buffer).load_method("forward").execute([x])
[op_quantize.cpp:452] In function quantize_per_channel_out(), assert failed (scale.scalar_type() == ScalarType::Double): scale.scalar_type() 6 is not double type
The process is then killed by SIGABRT, on axes 0, 1 and -1 alike. dequantize_per_tensor.tensor with a float32 scale aborts at op_dequantize.cpp:345 (Expected scale to be Double tensor received: 6), and quantize_per_tensor.tensor fails with error 0x12. With float64 scales all three run and match eager.
I would expect float32 scales to be read like float64 ones, as dequantize_per_channel does. I have a small fix with C++ tests and will open a PR linked to this issue.
Versions
ExecuTorch built from main at e67ec4e (Python bindings and quantized_ops_aot_lib built from source), PyTorch 2.15.0+cpu, Python 3.12.3, Ubuntu 24.04 on WSL2, x86_64.
This issue was written with the help of Claude Code (Anthropic); I verified the reproduction.
- Lingua principale
- Python
- Stelle
- 5.2k
- Fork
- 1.3k
- Merge medio
- 1g 7h
- PR unite (30g)
- 644
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
-
to_edge_transform_and_lower ignores some ops_to_not_decompose requests: multi-output ops, and non-core ops without a decompositionForse già presa @Eureka-Zhang l’ha presa 7 giorni fa. Apertamodule: exir
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
pytorch/executorch#25620 ·
I maintainer di solito rispondono entro 1 giorno
-
Qualcomm AI Engine Direct - fp16a8w quantization crashes on layer_normForse già presa @psiddh l’ha presa 21 giorni fa. Apertabug module: qnn partner: qualcomm
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
pytorch/executorch#24434 · 1 assegnatario ·
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
-
XNNPACK INT4 linear returns incorrect per-channel outputs and fails groupwise FP16 on Apple M4 MaxForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug module: quantization module: xnnpack
Difficoltà 4/5 3-5 giorni Idoneità per principianti 43/100
pytorch/executorch#25854 ·
I maintainer di solito rispondono entro 1 giorno
-
Quantized quantize/dequantize kernels abort the process on a bfloat16 input or outputForse già presa @AxelNoun l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
pytorch/executorch#25822 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pytorch/executorch
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Forse già presa @cestercian l’ha presa oggi. Apertacomp/cli P2 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NousResearch/hermes-agent#162259 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[request] gRpc/1.86.0Apertaupstream update
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
conan-io/conan-center-index#31597 ·
I maintainer di solito rispondono entro 1 giorno
-
bug enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
AOSSIE-Org/PictoPy#1802 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
community-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA-NeMo/Run#727 ·
I maintainer di solito rispondono entro 1 giorno