Skip to content

issue/1235 - implement and optimize conv2d packaging#1241

Open
wooway777 wants to merge 1 commit into
mainfrom
issue/1235
Open

issue/1235 - implement and optimize conv2d packaging#1241
wooway777 wants to merge 1 commit into
mainfrom
issue/1235

Conversation

@wooway777

@wooway777 wooway777 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

closes #1235

补全并优化conv的外层封装,

原来这里直接检查:
INFINICORE_ASSERT_TENSORS_SAME_DEVICE(output, input, weight, bias);
但 bias 可以是空 Tensor。当 Python 侧或 C++ 侧传无 bias 卷积时,这个宏会把空 bias 也当成有效 tensor 去访问,导致崩溃风险。
所以改成:

INFINICORE_ASSERT_TENSORS_SAME_DEVICE(output, input, weight);
if (bias) {
    INFINICORE_ASSERT_TENSORS_SAME_DEVICE(output, bias);
}

也就是:output/input/weight 必须同设备;只有 bias 存在时才检查 bias。
虽然 Python wrapper 里后来为了底层 infiniop 路径稳定,已经在 bias is None 时补了零 bias,但 C++ 上层 conv2d 本身也应该正确处理可选 bias。这个改动就是把这个语义补完整。

image

先前本测试不可用

@wooway777 wooway777 requested a review from a team June 11, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEV] conv2d外层封装

1 participant