提交 00204a22 authored 作者: Frederic Bastien's avatar Frederic Bastien

Test the shape that don't generate the good stride without testing the stride.

Doc that it will get fixed with GpuNdArray.
上级 ef3c9199
......@@ -814,15 +814,22 @@ def test_setitem_rightvalue_ndarray_fails():
assert True
def test_zeros_basic():
# 3d
for shp in [(3,4,5), (300,), (), (0,7)]:
## TODO these shape do not work:
# (3,0), (4,1,5)
_a = cuda_ndarray.CudaNdarray.zeros(shp)
_n = numpy.zeros(shp, dtype="float32")
assert numpy.allclose(numpy.asarray(_a), _n)
assert _a.shape == _n.shape
assert all(_a._strides == numpy.asarray(_n.strides)/4)
# TODO:The following don't have the same stride!
# This should be fixed with the new GpuNdArray.
for shp in [(3,0), (4,1,5)]:
_a = cuda_ndarray.CudaNdarray.zeros(shp)
_n = numpy.zeros(shp, dtype="float32")
assert numpy.allclose(numpy.asarray(_a), _n)
assert _a.shape == _n.shape
try:
_n = numpy.zeros()
except TypeError:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论