Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将 1x1x16 的卷积核进行零填充扩展为 3x3x16 的卷积核,以得到和 1x1x16 同样的卷积输出。 #274

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 03Compiler/03Frontend/03OPFusion.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ if __name__ == "__main__":

# kernel fusion
# 将 conv2 的卷积核权重由(1, 1)扩展到(3, 3)
weight_expanded = F.interpolate(conv2_weight, size=(3, 3), mode='bilinear', align_corners=False)
weight_expanded = torch.zeros(16, 3, 3, 3)
weight_expanded[:, :, 1, 1] = conv2_weight[:, :, 0, 0]
# conv1 卷积核与 conv2 卷积核融合
weight_fusion = torch.concatenate([conv1_weight, weight_expanded], dim=0)
# conv1 偏置与 conv2 偏置融合
Expand Down