Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a5a3632f
提交
a5a3632f
authored
8月 17, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
metter error msg and fix potential futur bug.
currently indices_obj and indices are the same, but it can change in the futur.
上级
6e16ef97
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
14 行删除
+16
-14
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+16
-14
没有找到文件。
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
a5a3632f
...
@@ -839,14 +839,14 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -839,14 +839,14 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
PyObject
*
axis_iobj
=
PyNumber_Long
(
axis_obj
);
PyObject
*
axis_iobj
=
PyNumber_Long
(
axis_obj
);
if
(
!
axis_iobj
)
{
if
(
!
axis_iobj
)
{
PyErr_SetString
(
PyExc_NotImplementedError
,
"CudaNdarray_TakeFrom: axis must be convertable to a long"
);
PyErr_SetString
(
PyExc_NotImplementedError
,
"CudaNdarray_TakeFrom: axis must be convertable to a long"
);
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
return
NULL
;
return
NULL
;
}
}
long
axis
=
PyInt_AsLong
(
axis_iobj
);
long
axis
=
PyInt_AsLong
(
axis_iobj
);
Py_DECREF
(
axis_iobj
);
axis_iobj
=
NULL
;
Py_DECREF
(
axis_iobj
);
axis_iobj
=
NULL
;
if
(
axis
!=
0
)
{
if
(
axis
!=
0
)
{
PyErr_SetString
(
PyExc_NotImplementedError
,
"CudaNdarray_TakeFrom: only axis=0 is currently supported"
);
PyErr_SetString
(
PyExc_NotImplementedError
,
"CudaNdarray_TakeFrom: only axis=0 is currently supported"
);
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
return
NULL
;
return
NULL
;
}
}
...
@@ -869,13 +869,13 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -869,13 +869,13 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
if
(
!
out
)
{
if
(
!
out
)
{
out
=
(
CudaNdarray
*
)
CudaNdarray_New
();
out
=
(
CudaNdarray
*
)
CudaNdarray_New
();
if
(
!
out
){
if
(
!
out
){
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
free
(
dims
);
free
(
dims
);
return
NULL
;
return
NULL
;
}
}
if
(
CudaNdarray_alloc_contiguous
(
out
,
self
->
nd
,
dims
))
{
if
(
CudaNdarray_alloc_contiguous
(
out
,
self
->
nd
,
dims
))
{
Py_DECREF
(
out
);
Py_DECREF
(
out
);
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
free
(
dims
);
free
(
dims
);
return
NULL
;
return
NULL
;
}
}
...
@@ -887,14 +887,16 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -887,14 +887,16 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
if
(
clipmode_obj
)
{
if
(
clipmode_obj
)
{
char
*
clipmode
=
PyString_AsString
(
clipmode_obj
);
char
*
clipmode
=
PyString_AsString
(
clipmode_obj
);
if
(
!
clipmode
){
if
(
!
clipmode
){
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
free
(
dims
);
free
(
dims
);
return
NULL
;
return
NULL
;
}
}
if
(
strcmp
(
clipmode
,
"raise"
)
!=
0
)
{
if
(
strcmp
(
clipmode
,
"raise"
)
!=
0
)
{
PyErr_SetString
(
PyExc_NotImplementedError
,
"CudaNdarray_TakeFrom: only the raise mode is currently supported"
);
PyErr_Format
(
PyExc_NotImplementedError
,
Py_DECREF
(
indices_obj
);
"CudaNdarray_TakeFrom: only the raise mode is currently supported. Got '%s'"
,
clipmode
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
free
(
dims
);
free
(
dims
);
return
NULL
;
return
NULL
;
...
@@ -913,7 +915,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -913,7 +915,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
if
(
err_var
==
NULL
)
{
if
(
err_var
==
NULL
)
{
err_var
=
(
int
*
)
device_malloc
(
sizeof
(
int
));
err_var
=
(
int
*
)
device_malloc
(
sizeof
(
int
));
if
(
!
err_var
)
{
// PyErr set by device_malloc
if
(
!
err_var
)
{
// PyErr set by device_malloc
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
free
(
dims
);
free
(
dims
);
return
NULL
;
return
NULL
;
...
@@ -928,7 +930,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -928,7 +930,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"Error setting device error code to 0. %s"
,
"Error setting device error code to 0. %s"
,
cudaGetErrorString
(
err
));
cudaGetErrorString
(
err
));
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
free
(
dims
);
free
(
dims
);
return
NULL
;
return
NULL
;
...
@@ -1025,7 +1027,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -1025,7 +1027,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
"Cuda error: %s: %s.
\n
"
,
"Cuda error: %s: %s.
\n
"
,
"CudaNdarray_TakeFrom"
,
"CudaNdarray_TakeFrom"
,
cudaGetErrorString
(
err
));
cudaGetErrorString
(
err
));
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1040,7 +1042,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -1040,7 +1042,7 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
"Cuda error: %s: %s when trying to get the error value.
\n
"
,
"Cuda error: %s: %s when trying to get the error value.
\n
"
,
"CudaNdarray_TakeFrom"
,
"CudaNdarray_TakeFrom"
,
cudaGetErrorString
(
err
));
cudaGetErrorString
(
err
));
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1055,17 +1057,17 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
...
@@ -1055,17 +1057,17 @@ CudaNdarray_TakeFrom(CudaNdarray * self, PyObject *args){
err
=
cudaMemset
((
void
*
)
err_var
,
0
,
sizeof
(
int
));
err
=
cudaMemset
((
void
*
)
err_var
,
0
,
sizeof
(
int
));
if
(
cudaSuccess
!=
err
)
{
if
(
cudaSuccess
!=
err
)
{
PyErr_Format
(
PyExc_MemoryError
,
"Error setting device error code to 0 after having an index error. %s"
,
cudaGetErrorString
(
err
));
PyErr_Format
(
PyExc_MemoryError
,
"Error setting device error code to 0 after having an index error. %s"
,
cudaGetErrorString
(
err
));
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
return
NULL
;
return
NULL
;
}
}
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
Py_DECREF
(
out
);
Py_DECREF
(
out
);
return
NULL
;
return
NULL
;
}
}
Py_DECREF
(
indices
_obj
);
Py_DECREF
(
indices
);
if
(
verbose
)
printf
(
"TAKE SUCCEDED
\n
"
);
if
(
verbose
)
printf
(
"TAKE SUCCEDED
\n
"
);
return
(
PyObject
*
)
out
;
return
(
PyObject
*
)
out
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论