Skip to content

Commit

Permalink
Merge pull request chenzomi12#274 from AndroidHot/patch-1
Browse files Browse the repository at this point in the history
将 1x1x16 的卷积核进行零填充扩展为 3x3x16 的卷积核,以得到和 1x1x16 同样的卷积输出。
  • Loading branch information
chenzomi12 authored Aug 18, 2024
2 parents 2d7ebf3 + a8024c5 commit e11a61b
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit e11a61b

Please sign in to comment.