From 432ae32409139e5563ae7dfdbe2fbadbe2b7ff7b Mon Sep 17 00:00:00 2001 From: liyiqi Date: Fri, 13 Jan 2023 17:05:10 +0800 Subject: [PATCH] fix MaxPool3DGradGrad bug --- config/super_bar_config.json | 4 +++- mindspore/ccsrc/include/backend/data_queue/data_queue.h | 4 ++-- mindspore/ccsrc/include/common/utils/utils.h | 1 + .../ccsrc/plugin/device/ascend/hal/device/ascend_data_queue.h | 2 +- .../optimizer/ir_fission/max_pool3d_grad_grad_fission.cc | 4 ++-- .../optimizer/mindir/reg_ascend_vm_op_adaptation_info.h | 1 + 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/super_bar_config.json b/config/super_bar_config.json index 024135cf797..afb4db87d9e 100644 --- a/config/super_bar_config.json +++ b/config/super_bar_config.json @@ -240,7 +240,9 @@ "axes": "axis" }, "MaxPool3DGradGradD": { - "ksize": "kernel_size" + "ksize": "kernel_size", + "pads": "pad_list", + "data_format": "format" } }, "AttrDefaultValue": { diff --git a/mindspore/ccsrc/include/backend/data_queue/data_queue.h b/mindspore/ccsrc/include/backend/data_queue/data_queue.h index 83cceaae3b5..e409764434f 100644 --- a/mindspore/ccsrc/include/backend/data_queue/data_queue.h +++ b/mindspore/ccsrc/include/backend/data_queue/data_queue.h @@ -54,8 +54,8 @@ class BACKEND_EXPORT DataQueue { virtual DataQueueStatus Front(std::vector *data) const = 0; virtual DataQueueStatus Pop() = 0; virtual void SetThreadDevice() {} - virtual size_t Size() { return size_; } - virtual size_t Capacity() { return capacity_; } + virtual size_t Size() const { return size_; } + virtual size_t Capacity() const { return capacity_; } protected: const std::string channel_name_; diff --git a/mindspore/ccsrc/include/common/utils/utils.h b/mindspore/ccsrc/include/common/utils/utils.h index 524a0281e5d..59b967aa0a5 100644 --- a/mindspore/ccsrc/include/common/utils/utils.h +++ b/mindspore/ccsrc/include/common/utils/utils.h @@ -429,6 +429,7 @@ constexpr auto kMaximumGradGradOpName = "MaximumGradGrad"; constexpr auto kMaximumGradOpName = "MaximumGrad"; constexpr auto kMaximumOpName = "Maximum"; constexpr auto kMaxPool3DGradGradOpName = "MaxPool3DGradGrad"; +constexpr auto kMaxPool3DGradGradDOpName = "MaxPool3DGradGradD"; constexpr auto kMaxPool3DGradOpName = "MaxPool3DGrad"; constexpr auto kMaxPool3DOpName = "MaxPool3D"; constexpr auto kMaxPoolGradOpName = "MaxPoolGrad"; diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_data_queue.h b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_data_queue.h index e7101d1d0e0..bd645d9bce1 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_data_queue.h +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_data_queue.h @@ -68,7 +68,7 @@ class WingmanQueue : public DataQueue { DataQueueStatus Pop() override; bool IsEmpty() const override { return queue_.empty(); } bool IsFull() const override { return false; } - size_t Size() override { return queue_.size(); } + size_t Size() const override { return queue_.size(); } private: std::queue> queue_; diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/max_pool3d_grad_grad_fission.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/max_pool3d_grad_grad_fission.cc index f569ebc79ee..4cc3b6b5c23 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/max_pool3d_grad_grad_fission.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/max_pool3d_grad_grad_fission.cc @@ -98,7 +98,7 @@ ValueNodePtr CreateValueNode(const AnfNodePtr &node) { const BaseRef MaxPool3DGradGradFission::DefinePattern() const { VarPtr Xs = std::make_shared(); - auto max_pool3d_grad_grad_prim = std::make_shared(kMaxPool3DGradGradOpName); + auto max_pool3d_grad_grad_prim = std::make_shared(kMaxPool3DGradGradDOpName); return VectorRef({max_pool3d_grad_grad_prim, Xs}); } @@ -113,7 +113,7 @@ const AnfNodePtr MaxPool3DGradGradFission::Process(const FuncGraphPtr &graph, co MS_LOG(INFO) << "The node " << cnode->DebugString() << " is not equal to " << kInputNum << " inputs"; return nullptr; } - std::vector new_inputs{NewValueNode(std::make_shared(kMaxPool3DGradGradOpName))}; + std::vector new_inputs{NewValueNode(std::make_shared(kMaxPool3DGradGradDOpName))}; auto assist_const = CreateValueNode(cnode); (void)new_inputs.insert(new_inputs.cend(), cnode->inputs().cbegin() + 1, cnode->inputs().cend()); (void)new_inputs.emplace_back(assist_const); diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/reg_ascend_vm_op_adaptation_info.h b/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/reg_ascend_vm_op_adaptation_info.h index 0c4088fbfc3..64cec110257 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/reg_ascend_vm_op_adaptation_info.h +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/reg_ascend_vm_op_adaptation_info.h @@ -89,6 +89,7 @@ REG_ASCEND_VM_OP_ADAPTATION_INFO(kLogSoftmaxOpName).set_backend_op_name(kLogSoft REG_ASCEND_VM_OP_ADAPTATION_INFO(kMatrixDiagOpName).set_backend_op_name(kMatrixDiagDOpName); REG_ASCEND_VM_OP_ADAPTATION_INFO(kMatrixDiagPartOpName).set_backend_op_name(kMatrixDiagPartDOpName); REG_ASCEND_VM_OP_ADAPTATION_INFO(kMatrixSetDiagOpName).set_backend_op_name(kMatrixSetDiagDOpName); +REG_ASCEND_VM_OP_ADAPTATION_INFO(kMaxPool3DGradGradOpName).set_backend_op_name(kMaxPool3DGradGradDOpName); REG_ASCEND_VM_OP_ADAPTATION_INFO(kIm2ColOpName).set_backend_op_name(kIm2colOpName); REG_ASCEND_VM_OP_ADAPTATION_INFO(kNewIm2ColOpName).set_backend_op_name(kIm2colOpName); REG_ASCEND_VM_OP_ADAPTATION_INFO(kParallelResizeBilinearOpName).set_backend_op_name(kSyncResizeBilinearV2OpName);