提交 bb96ebe8 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix CudaNdarray.__copy__ that returned a full copy instead of a shallow copy.

updated test to check for this.
上级 2e7311dc
......@@ -572,9 +572,9 @@ static PyMethodDef CudaNdarray_methods[] =
{"__array__",
(PyCFunction)CudaNdarray_CreateArrayObj, METH_NOARGS,
"Copy from the device to a numpy ndarray"},
{"__copy__",
(PyCFunction)CudaNdarray_Copy, METH_NOARGS,
"Create a copy of this object"},
{"__copy__",
(PyCFunction)CudaNdarray_View, METH_NOARGS,
"Create a shallow copy of this object. used by module copy"},
{"__deepcopy__",
(PyCFunction)CudaNdarray_DeepCopy, METH_O,
"Create a copy of this object"},
......
......@@ -90,6 +90,11 @@ def test_copy():
assert numpy.allclose(a, numpy.asarray(b))
assert numpy.allclose(a, numpy.asarray(c))
assert numpy.allclose(a, numpy.asarray(d))
b+=b
assert numpy.allclose(a+a, numpy.asarray(b))
assert numpy.allclose(a+a, numpy.asarray(c))
assert numpy.allclose(a, numpy.asarray(d))
def test_dot():
print >>sys.stdout, 'starting test_dot'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论