issue/1235 - implement and optimize conv2d packaging#1241
Open
wooway777 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #1235
补全并优化conv的外层封装,
原来这里直接检查:
INFINICORE_ASSERT_TENSORS_SAME_DEVICE(output, input, weight, bias);但 bias 可以是空 Tensor。当 Python 侧或 C++ 侧传无 bias 卷积时,这个宏会把空 bias 也当成有效 tensor 去访问,导致崩溃风险。
所以改成:
也就是:output/input/weight 必须同设备;只有 bias 存在时才检查 bias。
虽然 Python wrapper 里后来为了底层 infiniop 路径稳定,已经在 bias is None 时补了零 bias,但 C++ 上层 conv2d 本身也应该正确处理可选 bias。这个改动就是把这个语义补完整。
先前本测试不可用