conv3d, maxPool3d and avgPool3d with pad 'same' use the wrong window when the filter is smaller than the stride
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- backend, machine-learning
Direzione di ricerca
Inizia da tfjs-core/src/ops/conv_util.ts e confronta get3DPadAndOutInfo con l’implementazione 2D di getPadAndOutInfo. Riproduci il problema con l’esempio fornito, con stride 2 e dimensioni 1×1×1, e controlla i test di convoluzione 3D e pooling. Il lavoro è completato quando tutte e tre le ops campionano le posizioni 0 e 2 con pad: 'same', mentre la forma dell’output rimane corretta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux x86_64 (Debian 12)
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: n/a
- TensorFlow.js installed from (npm or script link): npm
- TensorFlow.js version (use command below): @tensorflow/tfjs-core, @tensorflow/tfjs-backend-cpu, @tensorflow/tfjs-backend-wasm 4.22.0 (master 7f5309fe is unchanged), Node.js 26.13.0
- Browser version: n/a
- Tensorflow.js Converter Version: n/a
Describe the current behavior
With pad: 'same', the 3D ops (conv3d, maxPool3d, avgPool3d) read the wrong input positions when TensorFlow's SAME padding formula would be negative before clamping in some dimension, which happens whenever the filter is smaller than the stride (for example a 1x1x1 filter with stride 2, as in a strided 1x1x1 projection). The output has the right shape, [1, 1, 1, 2, 1], but is shifted by one element ([2, 4]). The CPU and WASM backends produce the same result.
Describe the expected behavior
Positions 0 and 2 are sampled, giving [1, 3], matching TensorFlow Python and TensorFlow.js 2D ops.
Standalone code to reproduce the issue
const tf = require("@tensorflow/tfjs-core");
require("@tensorflow/tfjs-backend-cpu");
(async () => {
await tf.setBackend("cpu");
const x = tf.tensor5d([1, 2, 3, 4], [1, 1, 1, 4, 1]);
tf.maxPool3d(x, [1, 1, 1], [1, 1, 2], "same").print();
tf.avgPool3d(x, [1, 1, 1], [1, 1, 2], "same").print();
tf.conv3d(x, tf.ones([1, 1, 1, 1, 1]), [1, 1, 2], "same").print();
})();
All three print:
Tensor
[[[[[2],
[4]]]]]
TensorFlow (tf.nn.max_pool3d, tf.nn.avg_pool3d, tf.nn.conv3d with "SAME") and the 2D equivalent tf.maxPool(tf.tensor4d([1, 2, 3, 4], [1, 1, 4, 1]), 1, 2, "same") print [1, 3].
Other info / logs
get3DPadAndOutInfo in tfjs-core/src/ops/conv_util.ts computes padAlongDepth, padAlongHeight, and padAlongWidth as (out - 1) * stride + filter - in without Math.max(0, ...), whereas the 2D version getPadAndOutInfo clamps each to at least 0. Here the width padding is -1, so left becomes -1 and every window starts one element late.
Credit: https://ucsbplse.github.io/
- Lingua principale
- TypeScript
- Stelle
- 19.2k
- Fork
- 2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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 tensorflow/tfjs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tensorflow/tfjs#8754 ·
-
Review argparse dependency bringing in sprintf-js CVE-2026-97058Forse già presa @Varun-S10 l’ha presa 19 giorni fa. Apertatype:others
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
tensorflow/tfjs#8749 · 1 assegnatario ·
-
`@tensorflow/tfjs-node` installation issueForse di nuovo libera @nileshau-afk l’ha presa 29 giorni fa e non c’è nessuna pull request aperta. Apertatype:build/install
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
tensorflow/tfjs#8748 · 1 assegnatario ·
-
The package tfjs-node is not working in version 26.8.1 of NodeForse di nuovo libera @nileshau-afk l’ha presa 57 giorni fa e non c’è nessuna pull request aperta. Apertacomp:node.js type:bug
tensorflow/tfjs#8746 · 4 commenti · 1 reazione · 1 assegnatario ·
-
I'm getting these npm errors while trying to install @tensorflow/tfjs-nodeForse di nuovo libera @Varun-S10 l’ha presa 87 giorni fa e non c’è nessuna pull request aperta. Apertastat:awaiting tensorflower type:build/install type:support
tensorflow/tfjs#8740 · 4 commenti · 1 reazione · 1 assegnatario ·
Tutte le issue di tensorflow/tfjs
Issue simili
-
content triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
tool-submission
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
BraveOPotato/NoSignups#2348 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
code-yeongyu/oh-my-openagent#12784 ·
I maintainer di solito rispondono entro 1 giorno
-
external-issue to-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MomsBloomOrg/momsbloom-resources#84 ·
I maintainer di solito rispondono entro 1 giorno