提交 8891f29f authored 作者: notoraptor's avatar notoraptor 提交者: GitHub

Merge pull request #5597 from notoraptor/windows-fixes

Fix various GPU unit tests on Windows
......@@ -61,6 +61,8 @@ class GpuMaxAndArgmax(Op):
#endif
#endif
int err = 0;
unsigned %(name)s_redux_len = PyTuple_GET_SIZE(%(axes)s);
unsigned* %(name)s_axes_to_reduce = (unsigned*)malloc(%(name)s_redux_len * sizeof(unsigned));
for (unsigned i = 0; i < %(name)s_redux_len; ++i) {
......@@ -114,10 +116,12 @@ class GpuMaxAndArgmax(Op):
PyErr_SetString(PyExc_RuntimeError, "GpuMaxAndArgmax: unable to set argmax to 0 when input is a scalar.");
%(fail)s
}
} else if (GA_NO_ERROR !=
} else if (GA_NO_ERROR != (err =
GpuArray_maxandargmax(&%(max)s->ga, &%(argmax)s->ga, &%(X)s->ga, %(name)s_redux_len, %(name)s_axes_to_reduce)
) {
PyErr_SetString(PyExc_RuntimeError, "GpuMaxAndArgmax: unable to compute gpuarray maxandargmax.");
)) {
PyErr_Format(PyExc_RuntimeError,
"GpuMaxAndArgmax: unable to compute gpuarray maxandargmax: error %%d: %%s (%%s).",
err, gpuarray_error_str(err), GpuArray_error(&%(X)s->ga, err));
%(fail)s
}
"""
......@@ -137,4 +141,4 @@ class GpuMaxAndArgmax(Op):
""" % {'name': name, 'X': inputs[0]}
def c_code_cache_version(self):
return (1,)
return (1, 1)
......@@ -14,7 +14,7 @@ from .. import GpuArrayType
import math
# Number of values to be used in test tensors (except with 0-D tensors!).
test_size = 10000000
test_size = 10000
# NB: This order of "unsorted axes" is arbitrary and is here
# just to have the same informations on profile output
......
......@@ -533,7 +533,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
data = rand(4, 2, 3)
idx = [2, 2, 0, 0, 1, 1]
n = self.shared(data)
t = n[self.shared(numpy.asarray(idx))[::2]]
t = n[self.shared(numpy.asarray(idx).astype('int64'))[::2]]
self.assertTrue(isinstance(t.owner.op, tensor.AdvancedSubtensor1))
val = self.eval_output_and_check(t, op_type=self.adv_sub1, length=2)
utt.assert_allclose(data[idx[::2]], val)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论