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

conv2d: infer groups from input and filter shapes when not specified

Chiusa
#959 1 commento 1 reazione 0 assegnatari Vedi su GitHub

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

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

Agenda+
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
Proposal
  1. Remove the = 1 default from MLConv2dOptions.groups in the IDL, so that an omitted groups can be distinguished from an explicit groups: 1.

  2. In the conv2d() method steps, when options.groups is not present, set:

    groups = inputChannels / filterInputChannels
    

    where both are read according to inputLayout and filterLayout.
    Throw a TypeError if the division is not exact, or if outputChannels % 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: explicit group attribute (default 1)
  • PyTorch Conv2d: explicit groups (default 1)
  • WebNN conv2d already supports groups on 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

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 webmachinelearning/webnn

Tutte le issue di webmachinelearning/webnn

Issue simili

Altre issue su Machine Learning

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.