Skip to content

Commit 7afd78d

Browse files
bunelrsoumith
authored andcommitted
Cuda reduce in a consistent direction
1 parent d5e8210 commit 7afd78d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

THCTensorMathReduce.cuh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ kernelTransformReduceOuterDimIndex(K *tgt1,
469469

470470
for (unsigned col = 0; col < row_size; ++col) {
471471
// +1 for Lua index
472-
acc = binary_op(thrust::make_pair<K, Index>(*src, col + TH_INDEX_BASE),
473-
acc);
472+
acc = binary_op(acc,
473+
thrust::make_pair<K, Index>(*src, col + TH_INDEX_BASE));
474474
src += num_irows;
475475
}
476476

@@ -550,7 +550,7 @@ kernelTransformReduceInnermostDimIndex(K *tgt1,
550550
K *src = src_ + row * row_size;
551551
// Sequential reduction within a thread.
552552
for (unsigned col = threadIdx.x; col < row_size; col += blockDim.x) {
553-
acc = binary_op(thrust::make_pair<K, Index>(src[col], col + TH_INDEX_BASE), acc);
553+
acc = binary_op(acc, thrust::make_pair<K, Index>(src[col], col + TH_INDEX_BASE));
554554
}
555555
}
556556

0 commit comments

Comments
 (0)