提交 4d96960b authored 作者: Frederic Bastien's avatar Frederic Bastien

Implement CudaNdarray.__idiv__ and test it. This is needed for later test change.

上级 3ac57b00
...@@ -15,7 +15,7 @@ def test_host_to_device(): ...@@ -15,7 +15,7 @@ def test_host_to_device():
c = numpy.asarray(b) c = numpy.asarray(b)
assert numpy.all(a == c) assert numpy.all(a == c)
def test_add(): def test_add_iadd_idiv():
for shape in ((), (0,), (3,), (2,3), (1,10000000),(10,1000000), (100,100000), for shape in ((), (0,), (3,), (2,3), (1,10000000),(10,1000000), (100,100000),
(1000,10000),(10000,1000), (1000,10000),(10000,1000),
(4100,33,34),(33,4100,34),(33,34,4100), (4100,33,34),(33,4100,34),(33,34,4100),
...@@ -51,6 +51,11 @@ def test_add(): ...@@ -51,6 +51,11 @@ def test_add():
assert numpy.allclose(a0, numpy.asarray(b0)) assert numpy.allclose(a0, numpy.asarray(b0))
assert numpy.allclose(a0,a1*2) assert numpy.allclose(a0,a1*2)
b0 /= b1
a0 /= a1
assert numpy.allclose(a0, numpy.asarray(b0))
assert numpy.allclose(a0,numpy.ones(a0.shape)*2)
if len(shape)==2: if len(shape)==2:
#test not contiguous version. #test not contiguous version.
#should raise not implemented. #should raise not implemented.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论