conv3d, maxPool3d and avgPool3d with pad 'same' use the wrong window when the filter is smaller than the stride
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
調査の方向性
tfjs-core/src/ops/conv_util.tsから始めて、get3DPadAndOutInfoと2DのgetPadAndOutInfoの実装を比較します。提示されたstride 2、サイズ1×1×1の例で問題を再現し、3D畳み込みとプーリングのテストを確認します。pad: 'same'で3つすべてのopsが位置0と2をサンプリングし、出力形状が正しいままであれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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/
- 主要言語
- TypeScript
- スター
- 19.2k
- フォーク
- 2k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tensorflow/tfjs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
tensorflow/tfjs#8754 ·
-
Review argparse dependency bringing in sprintf-js CVE-2026-97058対応中かも @Varun-S10 が 19 日前に担当しました。 オープンtype:others
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
tensorflow/tfjs#8749 · 担当者 1 名 ·
-
`@tensorflow/tfjs-node` installation issue再び着手できるかも @nileshau-afk が 29 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンtype:build/install
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
tensorflow/tfjs#8748 · 担当者 1 名 ·
-
The package tfjs-node is not working in version 26.8.1 of Node再び着手できるかも @nileshau-afk が 57 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンcomp:node.js type:bug
tensorflow/tfjs#8746 · コメント 4 件 · リアクション 1 件 · 担当者 1 名 ·
-
I'm getting these npm errors while trying to install @tensorflow/tfjs-node再び着手できるかも @Varun-S10 が 87 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンstat:awaiting tensorflower type:build/install type:support
tensorflow/tfjs#8740 · コメント 4 件 · リアクション 1 件 · 担当者 1 名 ·
tensorflow/tfjs の issue をすべて見る
似ている issue
-
content triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
tool-submission
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
BraveOPotato/NoSignups#2348 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
code-yeongyu/oh-my-openagent#12784 ·
メンテナーはふだん 1 日以内に返信
-
external-issue to-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 71/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MomsBloomOrg/momsbloom-resources#84 ·
メンテナーはふだん 1 日以内に返信