Discrepancies with maxPool2d padding behavior

Abierto
#935 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
12/100
Tipo de issue
Documentación
Claridad
Necesita aclaración
Estado de actividad
Tranquilo

Línea de trabajo

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.

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

Descripción

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?
Lenguaje dominante
Bikeshed
Estrellas
566
Forks
72
Métricas de merge de PR
Sin PR fusionados en 30 d

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

Todos los issues de webmachinelearning/webnn

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.