conv2d: infer groups from input and filter shapes when not specified
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, machine-learning
- Ambito
- machine-learning
Direzione di ricerca
Start with the MLConv2dOptions dictionary in the WebNN IDL and the conv2d() algorithm steps in the spec source, where groups is currently defaulted to 1 and validated. Remove the default, then add a step that infers groups from inputChannels / filterInputChannels when it is absent, with the TypeError checks described in the issue. Done means omitted groups infers correctly, explicit groups keeps current validation, and convTranspose2d is unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
MLConv2dOptions.groups defaults to 1, so grouped convolutions only validate if groups is passed explicitly. LiteRT/TFLite CONV_2D does not carry a groups attribute; the group count is implied by inputChannels / filterInputChannels. Converters/delegates that map TFLite ops 1:1 to WebNN therefore fail validation for grouped convolutions:
TypeError: Failed to execute 'conv2d' on 'MLGraphBuilder':
The groups must evenly divide the input channels to filter input channels.
Evidence that TFLite/LiteRT has no groups attribute
- TFLite Schema:
Conv2DOptions= padding, stride_w/h, fused_activation_function, dilation_w/h_factor, quantized_bias_type — no groups - LiteRT C API exposes no Conv2d groups getter
- LiteRT Conv kernel derives it at runtime:
groups = input_channel / filter_input_channel
Real-world example: LiteRT.js EfficientViT segmentation demo
- Model: https://storage.googleapis.com/tfweb/litertjs_demo_models/efficientvit/efficientvit_seg_l2_ade20k_r512x512.tflite
- Input channels 1536, filter input channels 32 → implied groups = 48
- Downstream report: https://github.com/google-ai-edge/LiteRT/issues/9548
- Repro: https://litert.webnn.io/efficientvit-seg?backend=webnn-gpu&inference=1 (Chrome 154,
Enables WebNN APIflag enabled)
Proposal
-
Remove the
= 1default fromMLConv2dOptions.groupsin the IDL, so that an omittedgroupscan be distinguished from an explicitgroups: 1. -
In the
conv2d()method steps, whenoptions.groupsis not present, set:groups = inputChannels / filterInputChannelswhere both are read according to
inputLayoutandfilterLayout.
Throw a TypeError if the division is not exact, or ifoutputChannels % groups != 0.
An explicitly provided groups (including groups: 1) keeps today's validation unchanged.
convTranspose2d is out of scope: its filter's input-channel dimension always equals inputChannels, so groups cannot be inferred from shapes.
Cross-framework survey
- TFLite
CONV_2D: groups implicit (derived from input/filter shapes) - ONNX
Conv: explicitgroupattribute (default 1) - PyTorch
Conv2d: explicitgroups(default 1) - WebNN
conv2dalready supportsgroupson every backend, so this is only a front-end defaulting/validation change, not a new backend capability.
Alternatives considered
Fix in each delegate/converter (compute groups before calling conv2d). This works, but every implicit-group framework integration has to rediscover the rule, and the failure mode is a confusing validation error.
Backward compatibility
The default changes from "1" to "inferred". Graphs that are valid today stay valid: with groups omitted they already require inputChannels == filterInputChannels, so the inferred value is also 1.
@huningxin @fdwr PTAL
- Lingua principale
- Bikeshed
- Stelle
- 566
- Fork
- 72
- Merge medio
- 6g 5h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 webmachinelearning/webnn
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
webmachinelearning/webnn#967 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
webmachinelearning/webnn#966 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
webmachinelearning/webnn#965 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
webmachinelearning/webnn#964 · 1 commento · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
webmachinelearning/webnn#963 · 3 commenti · 2 reazioni ·
Tutte le issue di webmachinelearning/webnn
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Arekkazu/sgpmp-backend#744 ·
I maintainer di solito rispondono entro 1 giorno
-
regression skipped skipped_bmg
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
intel/torch-xpu-ops#5858 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ScrollPrize/villa#2299 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Latest releases still admits papers whose headline contribution is an agentForse già presa @rudycelekli l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
ktwu01/benchmark-radar#961 ·
I maintainer di solito rispondono entro 1 giorno