From 5fe3d596e4e53bfc9bc1452c9a0d948e4c8799ea Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 4 Mar 2021 17:14:16 +0800 Subject: [PATCH] Fix pow, use fillD instead of broadcast (#31433) --- paddle/fluid/operators/activation_op_npu.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/operators/activation_op_npu.cc b/paddle/fluid/operators/activation_op_npu.cc index 33d8214a75..24ebc00c48 100644 --- a/paddle/fluid/operators/activation_op_npu.cc +++ b/paddle/fluid/operators/activation_op_npu.cc @@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the Licnse. */ -#ifdef PADDLE_WITH_ASCEND_CL #include #include @@ -90,8 +89,8 @@ class PowGradNPUKernel : public framework::OpKernel { // factor. Tensor factor_bc_tensor(framework::proto::VarType::FP32); factor_bc_tensor.mutable_data(x_dims, place); - auto runner_bc = NpuOpRunner("BroadcastTo", {factor_tensor, x_shape}, - {factor_bc_tensor}, {}); + auto runner_bc = NpuOpRunner("FillD", {factor_tensor}, {factor_bc_tensor}, + {{"dims", x_dims}}); runner_bc.Run(stream); // Step 3: Compute x_power_mul_factor = factor * x.pow(factor-1) @@ -123,5 +122,3 @@ REGISTER_OP_NPU_KERNEL( pow_grad, ops::PowGradNPUKernel, ops::PowGradNPUKernel); - -#endif -- GitLab