提交 63990436 authored 作者: abergeron's avatar abergeron

Merge pull request #4301 from gokul-uf/gpujoin_fix

GpuJoin takes negative values for axis
......@@ -997,6 +997,8 @@ class GpuJoin(HideC, Join):
def perform(self, node, axis_and_tensors, out_, ctx):
out, = out_
axis = int(axis_and_tensors[0])
if axis < -axis_and_tensors[1].ndim:
raise IndexError
if axis < 0:
axis += axis_and_tensors[1].ndim
tensors = axis_and_tensors[1:]
......
......@@ -3884,7 +3884,7 @@ class T_Join_and_Split(unittest.TestCase):
got = f(-2)
assert numpy.allclose(got, want)
self.assertRaises((IndexError, OverflowError), f, -3)
self.assertRaises(IndexError, f, -3)
def test_join_matrixC_negative_axis(self):
"""constant join negative axis"""
......@@ -3916,7 +3916,7 @@ class T_Join_and_Split(unittest.TestCase):
got = f()
assert numpy.allclose(got, want)
self.assertRaises((IndexError, OverflowError), join, -3, a, b)
self.assertRaises(IndexError, join, -3, a, b)
utt.verify_grad(lambda a, b: join(-1, a, b), [v, 2 * v],
mode=self.mode)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论