From a8024c5faadca48e4418b8c630b78e5708008ebc Mon Sep 17 00:00:00 2001 From: Zhiwei Li Date: Fri, 9 Aug 2024 22:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=201x1x16=20=E7=9A=84=E5=8D=B7?= =?UTF-8?q?=E7=A7=AF=E6=A0=B8=E8=BF=9B=E8=A1=8C=E9=9B=B6=E5=A1=AB=E5=85=85?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E4=B8=BA=203x3x16=20=E7=9A=84=E5=8D=B7?= =?UTF-8?q?=E7=A7=AF=E6=A0=B8=EF=BC=8C=E4=BB=A5=E5=BE=97=E5=88=B0=E5=92=8C?= =?UTF-8?q?=201x1x16=20=E5=90=8C=E6=A0=B7=E7=9A=84=E5=8D=B7=E7=A7=AF?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03Compiler/03Frontend/03OPFusion.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/03Compiler/03Frontend/03OPFusion.md b/03Compiler/03Frontend/03OPFusion.md index 37f78d33..3f528fe7 100644 --- a/03Compiler/03Frontend/03OPFusion.md +++ b/03Compiler/03Frontend/03OPFusion.md @@ -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 偏置融合