diff --git a/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cpu.cc b/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cpu.cc index b72b7cb87530e037f399d9925df0a5ad75ae867c..6c4bf9a4f17e6f88503f0a1d6ec2f3029000b6f0 100644 --- a/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cpu.cc +++ b/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cpu.cc @@ -176,4 +176,4 @@ TEST(Benchmark, EagerIntermediateMLPCPU) { USE_OP_ITSELF(scale); USE_OP_ITSELF(elementwise_add); USE_OP_ITSELF(matmul_v2); -USE_OP(reduce_sum); +USE_OP_ITSELF(reduce_sum); diff --git a/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cuda.cc b/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cuda.cc index 701a9b2cba195dd53323e88c1044eb995b9725c5..14e7ce8cfcfb4dea0907cd128873223c8e5859a2 100644 --- a/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cuda.cc +++ b/paddle/fluid/eager/tests/performance_tests/benchmark_eager_cuda.cc @@ -185,7 +185,7 @@ TEST(Benchmark, EagerIntermediateMLPCUDA) { USE_OP_ITSELF(scale); USE_OP_ITSELF(matmul_v2); -USE_OP(reduce_sum); +USE_OP_ITSELF(reduce_sum); USE_OP(reduce_sum_grad); USE_OP_ITSELF(elementwise_add); diff --git a/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cpu.cc b/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cpu.cc index bea80809a3b17a81cf8d3e19dc535a1f733b1896..3292de9363696dae30d853980eca6fb1ba1055cc 100644 --- a/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cpu.cc +++ b/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cpu.cc @@ -214,4 +214,4 @@ TEST(Benchmark, FluidMLPCPU) { USE_OP_ITSELF(scale); USE_OP_ITSELF(elementwise_add); USE_OP_ITSELF(matmul_v2); -USE_OP(reduce_sum); +USE_OP_ITSELF(reduce_sum); diff --git a/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cuda.cc b/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cuda.cc index 86c1ad7e23a6a3d186d53c7ff14c1450883465cd..e9b7d10070dbf22f10e617d34f143992d19fb659 100644 --- a/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cuda.cc +++ b/paddle/fluid/eager/tests/performance_tests/benchmark_fluid_cuda.cc @@ -247,7 +247,7 @@ TEST(Benchmark, FluidMLPCUDA) { USE_OP_ITSELF(scale); USE_OP_ITSELF(matmul_v2); -USE_OP(reduce_sum); +USE_OP_ITSELF(reduce_sum); USE_OP(reduce_sum_grad); USE_OP_ITSELF(elementwise_add); diff --git a/paddle/fluid/framework/new_executor/standalone_executor_test.cc b/paddle/fluid/framework/new_executor/standalone_executor_test.cc index c1d449d30205e2e2495a921cadef7f7742a8cedc..2c3359ffa8e46f0d30a01d73fccb95d88771480a 100644 --- a/paddle/fluid/framework/new_executor/standalone_executor_test.cc +++ b/paddle/fluid/framework/new_executor/standalone_executor_test.cc @@ -35,8 +35,8 @@ USE_OP(sigmoid); USE_OP(tanh); USE_OP(elementwise_mul); USE_OP(softmax_with_cross_entropy); -USE_OP(reduce_mean); -USE_OP(reduce_sum); +USE_OP_ITSELF(reduce_mean); +USE_OP_ITSELF(reduce_sum); USE_OP(reduce_sum_grad); USE_OP(reduce_mean_grad); USE_OP_ITSELF(reshape2_grad); diff --git a/paddle/fluid/imperative/tests/test_tracer.cc b/paddle/fluid/imperative/tests/test_tracer.cc index afe1f92ca03b3bc0724c1d04c26cb8c57138c136..d05036f7a12ebdc3db5fbfda5eb50c295c0478e4 100644 --- a/paddle/fluid/imperative/tests/test_tracer.cc +++ b/paddle/fluid/imperative/tests/test_tracer.cc @@ -590,6 +590,6 @@ TEST(test_tracer, eager_tracer) { USE_OP(mul); USE_OP(mul_grad); -USE_OP(reduce_sum); +USE_OP_ITSELF(reduce_sum); USE_OP(reduce_sum_grad); USE_OP_ITSELF(elementwise_add); diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc index c8d568c8c2cf73041549a138085b72b41c0c297a..e80df5f95bb4ab33a6c08cc646d0ef8311e38936 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc @@ -99,13 +99,6 @@ REGISTER_OPERATOR(reduce_mean_grad, ops::ReduceGradOp, ops::ReduceMeanDoubleGradDescMaker, ops::ReduceMeanDoubleGradOpBaseMaker, ops::ReduceMeanGradNoNeedBufferVarInferer); -REGISTER_OP_CPU_KERNEL(reduce_mean, - ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel); template using CPUReduceMeanGradKernel = diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cu b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cu deleted file mode 100644 index 30a699e979efc40190a5c83850340f1f15dd918a..0000000000000000000000000000000000000000 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cu +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "paddle/fluid/operators/reduce_ops/reduce_mean_op.h" -#include "paddle/fluid/operators/reduce_ops/reduce_op.h" - -REGISTER_OP_CUDA_KERNEL( - reduce_mean, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel); diff --git a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc index cfafc11739948ba791654516147f49d6fda78bdf..bdab14a18a05ab3e0df1dbda57f3753033cfacb4 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc @@ -107,27 +107,6 @@ REGISTER_OPERATOR(reduce_sum_grad, ops::ReduceGradOp, ops::ReduceSumDoubleOpGradMaker, ops::ReduceSumGradNoNeedBufferVarInferer); -REGISTER_OP_CPU_KERNEL( - reduce_sum, ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel, - ops::ReduceKernel, ops::SumFunctor>, - ops::ReduceKernel, - - ops::SumFunctor>); - template using CPUReduceSumGradKernel = ops::ReduceSumGradKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, - ops::ReduceCudaKernel, kps::AddFunctor, - kps::IdentityFunctor>, - ops::ReduceCudaKernel, kps::AddFunctor, - kps::IdentityFunctor>); diff --git a/paddle/fluid/operators/reduce_ops/unity_build_rule.cmake b/paddle/fluid/operators/reduce_ops/unity_build_rule.cmake index 74781ef6f0237ab34a6c6590f5d014f352acba39..c4f32a8d25764b4cd0a7ce0a8cb4691fd2c8ea05 100644 --- a/paddle/fluid/operators/reduce_ops/unity_build_rule.cmake +++ b/paddle/fluid/operators/reduce_ops/unity_build_rule.cmake @@ -21,5 +21,4 @@ register_unity_group(cu register_unity_group(cu frobenius_norm_op.cu) register_unity_group(cu logsumexp_op.cu) register_unity_group(cu reduce_max_op.cu) -register_unity_group(cu reduce_mean_op.cu) register_unity_group(cu reduce_min_op.cu) diff --git a/paddle/phi/kernels/gpu/math_kernel.cu b/paddle/phi/kernels/gpu/math_kernel.cu index 2ae40bd4b1923bd59883bb474128624de85350f7..c3605ce655f2bde78c01a88db4dd70bd38c98431 100644 --- a/paddle/phi/kernels/gpu/math_kernel.cu +++ b/paddle/phi/kernels/gpu/math_kernel.cu @@ -165,4 +165,6 @@ PT_REGISTER_KERNEL(mean_raw, float, double, bool, - float16) {} + float16, + int, + int64_t) {} diff --git a/paddle/phi/kernels/math_kernel.cc b/paddle/phi/kernels/math_kernel.cc index 7fb6cc0ba9cca504dfdf8abab201712b22c21e4e..e1e3679ea8be89ef438b59e70889e23adc360ea0 100644 --- a/paddle/phi/kernels/math_kernel.cc +++ b/paddle/phi/kernels/math_kernel.cc @@ -152,6 +152,8 @@ PT_REGISTER_KERNEL(mean, float, double, bool, + int, + int64_t, phi::dtype::float16) {} PT_REGISTER_KERNEL(sum, GPU,