From e13930eb336e7f179b1782ccbb8671bdefe60f57 Mon Sep 17 00:00:00 2001 From: Yang Jiao Date: Tue, 15 Nov 2022 17:26:03 +0800 Subject: [PATCH] fix bprop biasaddgrad --- .../ccsrc/common/graph_kernel/bprop/grad/grad_nn_ops.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mindspore/ccsrc/common/graph_kernel/bprop/grad/grad_nn_ops.cc b/mindspore/ccsrc/common/graph_kernel/bprop/grad/grad_nn_ops.cc index 30e5510a86c..0642e88ac61 100644 --- a/mindspore/ccsrc/common/graph_kernel/bprop/grad/grad_nn_ops.cc +++ b/mindspore/ccsrc/common/graph_kernel/bprop/grad/grad_nn_ops.cc @@ -82,7 +82,12 @@ REG_BPROP_BUILDER(kBiasAddOpName).SetBody([](const BpropIRBuilder *ib) -> NodePt auto w = ib->GetInput(kIndex1); auto out = ib->GetInput(kIndex2); auto dout = ib->GetInput(kIndex3); - return {dout, ib->Emit(kBiasAddGradOpName, {dout}, {{"format", ib->GetAttr("data_format")}})}; + auto format = GetValue(ib->GetAttr("data_format")); + if (format == "NCDHW") { + format = "NCHW"; + } + return {dout, + ib->Emit(kBiasAddGradOpName, {dout}, {{"format", MakeValue(format)}, {"data_format", MakeValue(format)}})}; }); REG_BPROP_BUILDER(kReLUOpName).SetBody([](const BpropIRBuilder *ib) -> NodePtrList {