Skip to content

Commit fa3411c

Browse files
committed
add left_num * grid.z * grid.y
1 parent 140779d commit fa3411c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ struct ReduceConfig {
191191
if (should_reduce_again) {
192192
output_data = tmp->mutable_data<Ty>(
193193
framework::make_ddim(
194-
{static_cast<int64_t>(left_num * grid.y * sizeof(Ty))}),
194+
{static_cast<int64_t>(left_num * grid.z * grid.y * sizeof(Ty))}),
195195
place);
196196
} else {
197197
output_data = y_data;
@@ -674,10 +674,11 @@ void TensorReduceFunctorImpl(const framework::Tensor& x, framework::Tensor* y,
674674
auto x_data = x.data<Tx>();
675675
auto y_data = y->mutable_data<Ty>(x.place());
676676

677-
framework::Tensor tmp;
677+
// after config.run()
678678
// SetOutputData for ReduceHigherDim when should_reduce_again is true,
679679
// temp_output should be stored temp_data in output_data space or stored in
680680
// y_data;
681+
framework::Tensor tmp;
681682
config.SetOutputData(y_data, x.place(), &tmp);
682683

683684
if (config.reduce_num == 1) {

0 commit comments

Comments
 (0)