提交 485f11e2 authored 作者: Frederic Bastien's avatar Frederic Bastien

added CudaNdarray.dtype to have the same interface as TensorVariable

上级 cc2369f5
...@@ -1446,6 +1446,12 @@ CudaNdarray_set_dev_data(CudaNdarray *self, PyObject *value, void *closure) ...@@ -1446,6 +1446,12 @@ CudaNdarray_set_dev_data(CudaNdarray *self, PyObject *value, void *closure)
return CudaNdarray_set_device_data(self, (float*)newdevdata, (CudaNdarray*)self->base); return CudaNdarray_set_device_data(self, (float*)newdevdata, (CudaNdarray*)self->base);
} }
static PyObject *
CudaNdarray_get_dtype(CudaNdarray *self, void *closure)
{
return PyString_FromString("float32");
}
static PyGetSetDef CudaNdarray_getset[] = { static PyGetSetDef CudaNdarray_getset[] = {
{"shape", {"shape",
(getter)CudaNdarray_get_shape, (getter)CudaNdarray_get_shape,
...@@ -1462,6 +1468,11 @@ static PyGetSetDef CudaNdarray_getset[] = { ...@@ -1462,6 +1468,11 @@ static PyGetSetDef CudaNdarray_getset[] = {
(setter)CudaNdarray_set_dev_data, (setter)CudaNdarray_set_dev_data,
"device data pointer", "device data pointer",
NULL}, NULL},
{"dtype",
(getter)CudaNdarray_get_dtype,
NULL,
"The dtype of the element. Now always float32",
NULL},
{NULL, NULL, NULL, NULL} /* Sentinel */ {NULL, NULL, NULL, NULL} /* Sentinel */
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论