From 41ced8e2af40358e3052cd2933cf9694ef05f095 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Wed, 6 Jun 2018 14:07:29 +0800 Subject: [PATCH] Refine code --- paddle/fluid/operators/reverse_op.cc | 7 ------- paddle/fluid/operators/reverse_op.cu | 7 ------- paddle/fluid/operators/reverse_op.h | 4 +++- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/paddle/fluid/operators/reverse_op.cc b/paddle/fluid/operators/reverse_op.cc index 64c4c37bb06..a20f7d231fa 100644 --- a/paddle/fluid/operators/reverse_op.cc +++ b/paddle/fluid/operators/reverse_op.cc @@ -105,10 +105,3 @@ REGISTER_OP_CPU_KERNEL( ops::ReverseKernel, ops::ReverseKernel, ops::ReverseKernel) -REGISTER_OP_CPU_KERNEL( - reverse_grad, ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel) diff --git a/paddle/fluid/operators/reverse_op.cu b/paddle/fluid/operators/reverse_op.cu index 7a750c75b5b..635c41529b3 100644 --- a/paddle/fluid/operators/reverse_op.cu +++ b/paddle/fluid/operators/reverse_op.cu @@ -22,10 +22,3 @@ REGISTER_OP_CUDA_KERNEL( ops::ReverseKernel, ops::ReverseKernel, ops::ReverseKernel) -REGISTER_OP_CUDA_KERNEL( - reverse_grad, ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel, - ops::ReverseKernel) diff --git a/paddle/fluid/operators/reverse_op.h b/paddle/fluid/operators/reverse_op.h index 2af4268dfac..d3c54b73188 100644 --- a/paddle/fluid/operators/reverse_op.h +++ b/paddle/fluid/operators/reverse_op.h @@ -24,7 +24,9 @@ struct ReverseFunctor { void operator()(const DeviceContext& context, const framework::LoDTensor& in, framework::LoDTensor* out, const std::vector& axis) { Eigen::array reverse_axis; - reverse_axis.fill(false); + for (auto& i : reverse_axis) { + i = false; + } for (int a : axis) { reverse_axis[a] = true; } -- GitLab