Skip to content

Commit 5d199c8

Browse files
committed
half cuda bugfix
1 parent 186c0c9 commit 5d199c8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

aten/THC/THCGrid.cu

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ __global__ void gridKernel(int64_t *self, TensorInfo<T> posInfo, T *size,
88
int64_t *count, ptrdiff_t nNodes) {
99
KERNEL_LOOP(i, nNodes) {
1010
T *pos = posInfo.data + i * posInfo.stride[0];
11-
T c;
1211
int64_t coef = 1, value = 0;
1312
for (ptrdiff_t d = 0; d < posInfo.size[1]; d += posInfo.stride[1]) {
14-
c = THCNumerics<T>::div(pos[d], size[d]);
15-
c = ScalarConvert<int64_t, T>::to(ScalarConvert<T, int64_t>::to(c));
16-
value += coef * c;
13+
value += coef * ScalarConvert<T, int64_t>::to(THCNumerics<T>::div(pos[d], size[d]));
1714
coef *= count[d];
1815
}
1916
self[i] = value;

0 commit comments

Comments
 (0)