From 1d1ca0f877e19f5925d35e4ee94e1c27919459af Mon Sep 17 00:00:00 2001 From: WeiXin Date: Thu, 15 Jul 2021 16:47:10 +0800 Subject: [PATCH] [Cherry-Pick]Support finetuning the model saved on the MAC on the Linux (#34027) (#34154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复《jit.save在Mac系统上保存的模型,在Linux平台上无法对模型进行重训练》的问题。 原始PR: #34027 --- paddle/fluid/operators/matmul_op.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/matmul_op.cc b/paddle/fluid/operators/matmul_op.cc index c12aecc9ba..fdd1148627 100644 --- a/paddle/fluid/operators/matmul_op.cc +++ b/paddle/fluid/operators/matmul_op.cc @@ -232,7 +232,9 @@ class MatMulGradKernel : public framework::OpKernel { int head_number = 1; #if defined(PADDLE_WITH_MKLML) && !defined(PADDLE_WITH_CUDA) && \ !defined(PADDLE_WITH_HIP) - head_number = context.Attr("head_number"); + if (context.HasAttr("head_number")) { + head_number = context.Attr("head_number"); + } #endif if (head_number <= 1 && a.dims().size() == 3 && b.dims().size() <= 2) { -- GitLab