conv3d, maxPool3d and avgPool3d with pad 'same' use the wrong window when the filter is smaller than the stride
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 86/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- backend, machine-learning
Hướng nghiên cứu
Bắt đầu với tfjs-core/src/ops/conv_util.ts, so sánh get3DPadAndOutInfo với phần triển khai 2D của getPadAndOutInfo. Tái hiện vấn đề bằng ví dụ stride 2, kích thước 1×1×1 được cung cấp và kiểm tra các bài kiểm thử tích chập 3D và pooling. Công việc được xem là hoàn tất khi cả ba ops lấy mẫu tại các vị trí 0 và 2 với pad: 'same', đồng thời hình dạng đầu ra vẫn chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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/
- Ngôn ngữ chính
- TypeScript
- Star
- 19.2k
- Fork
- 2k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tensorflow/tfjs
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
tensorflow/tfjs#8754 ·
-
Review argparse dependency bringing in sprintf-js CVE-2026-97058Có thể đã có người làm @Varun-S10 đã nhận 19 ngày trước. Đang mởtype:others
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
tensorflow/tfjs#8749 · 1 người được giao ·
-
`@tensorflow/tfjs-node` installation issueCó thể làm lại được @nileshau-afk đã nhận 29 ngày trước và không có pull request nào đang mở. Đang mởtype:build/install
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
tensorflow/tfjs#8748 · 1 người được giao ·
-
The package tfjs-node is not working in version 26.8.1 of NodeCó thể làm lại được @nileshau-afk đã nhận 57 ngày trước và không có pull request nào đang mở. Đang mởcomp:node.js type:bug
tensorflow/tfjs#8746 · 4 bình luận · 1 reaction · 1 người được giao ·
-
I'm getting these npm errors while trying to install @tensorflow/tfjs-nodeCó thể làm lại được @Varun-S10 đã nhận 87 ngày trước và không có pull request nào đang mở. Đang mởstat:awaiting tensorflower type:build/install type:support
tensorflow/tfjs#8740 · 4 bình luận · 1 reaction · 1 người được giao ·
Tất cả issue của tensorflow/tfjs
Issue tương tự
-
content triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
BraveOPotato/NoSignups#2348 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
code-yeongyu/oh-my-openagent#12784 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
external-issue to-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MomsBloomOrg/momsbloom-resources#84 ·
Maintainer thường phản hồi trong vòng 1 ngày