提交 37013a1d authored 作者: Frederic Bastien's avatar Frederic Bastien

add the property size to CudaNdarray object to have more similar interface then numpy.ndarray

上级 62172cc1
......@@ -1503,6 +1503,12 @@ static PyGetSetDef CudaNdarray_getset[] = {
NULL,
"The dtype of the element. Now always float32",
NULL},
{"size",
(getter)CudaNdarray_SIZE_Object,
NULL,
"Return the number of element in this objects.",
NULL},
{NULL, NULL, NULL, NULL} /* Sentinel */
};
......
......@@ -286,7 +286,11 @@ CudaNdarray_SIZE(const CudaNdarray *self)
}
return size;
}
static PyObject *
CudaNdarray_SIZE_Object(const CudaNdarray *self, void *closure)
{
return PyInt_FromLong(CudaNdarray_SIZE(self));
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论