Discrepancies with maxPool2d padding behavior

オープン
#935 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
12/100
issue の種類
ドキュメント
明瞭さ
説明が足りない
活発さ
静か

調査の方向性

The issue asks the working group to decide how maxPool2d should treat a pooling window that covers only padding, with TFLite returning 0 and CoreML returning -Infinity. Start by reading the four-comment thread to see where the discussion stalled, then the maxPool2d section of the WebNN spec. Done means a recorded working-group decision on the padding-only case, followed by a spec change. A newcomer can't finish this alone, so ask in the thread before writing anything.

索引モデルが issue の本文から書いたものです。

説明

operator specific

When implementing and testing maxPool2d with roundingType: "ceil", we encountered a case where different backends produce inconsistent results for windows that cover only padding elements. The WebNN specification does not seem to explicitly define the expected behavior for this edge case.

Test Case

Input Shape: [1, 2, 5, 5]
Window Dimensions: [3, 3]
Strides: [3, 3]
Padding: [1, 1, 1, 1] (Symmetric)
Rounding Type: 'ceil'
With these parameters, the output shape is [1, 2, 3, 3]. The windows in the last row and last column cover only padding elements (since the valid input is 5x5 and padding expands it to 7x7, but the stride of 3 moves the last window to start at index 6, covering indices 6, 7, 8 which are padding or outside).

Observations
  • TFLite Backend: Returns 0 for these empty windows.
  • CoreML Backend: Returns -Infinity for these empty windows.

If padding elements are strictly ignored for maxPool2d (to prevent padding values from becoming the maximum), then a window covering only padding elements contains no valid elements.

Mathematically, the maximum of an empty set is defined as $-\infty$. CoreML's behavior is consistent with this interpretation.
TFLite's behavior suggesting it treats padding as 0 or defaults to 0 when no valid elements are present.

Questions for the Working Group
  • What is the expected behavior when a pooling window covers only padding elements for maxPool2d?
  • Should the spec clarify whether padding elements are treated as $-\infty$ (ignored) or if there is a fallback value like 0 when no valid input elements are in the window?
主要言語
Bikeshed
スター
566
フォーク
72
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

webmachinelearning/webnn のほかの issue

webmachinelearning/webnn の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。