Skip to content

Commit bf0ca67

Browse files
committed
update
1 parent e272121 commit bf0ca67

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

paddle/fluid/operators/reduce_ops/reduce_op.cu.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,20 +639,21 @@ void TensorReduceFunctorImpl(const framework::Tensor& x, framework::Tensor* y,
639639
auto config = ReduceConfig<Ty>(origin_reduce_dims, x_dim);
640640
config.Run(); // get the parameters of LaunchReduceKernel
641641

642-
if (config.reduce_num == 1) {
643-
auto out_dims = y->dims();
644-
framework::TensorCopy(x, y->place(), y);
645-
y->Resize(out_dims);
646-
return;
647-
}
648-
649642
// after config.run()
650643
// SetOutputData for ReduceHigherDim when should_reduce_again is true,
651644
// temp_output should be stored temp_data in output_data space or stored in
652645
// y_data;
653646
framework::Tensor tmp;
654647
auto x_data = x.data<Tx>();
655648
auto y_data = y->mutable_data<Ty>(x.place());
649+
650+
if (config.reduce_num == 1) {
651+
auto out_dims = y->dims();
652+
framework::TensorCopy(x, y->place(), y);
653+
y->Resize(out_dims);
654+
return;
655+
}
656+
656657
config.SetOutputData(y_data, x.place(), &tmp);
657658

658659
using TransformOp = typename ReduceOp<Tx, Ty>::Transformer;

paddle/fluid/operators/reduce_ops/reduce_prod_op.cu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "paddle/fluid/operators/reduce_ops/reduce_op.cu.h"
1717
#include "paddle/fluid/operators/reduce_ops/reduce_prod_op.h"
1818

19-
// reduce_prod
2019
REGISTER_OP_CUDA_KERNEL(
2120
reduce_prod, ops::ReduceCudaKernel<float, paddle::operators::CustomMul>,
2221
ops::ReduceCudaKernel<int, paddle::operators::CustomMul>,

0 commit comments

Comments
 (0)