Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2f90f3b0
提交
2f90f3b0
authored
7月 10, 2017
作者:
João Victor Tozatti Risso
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add more information and correct indentation of error messages in dnn_sptf
Signed-off-by:
João Victor Tozatti Risso
<
joaovictor.risso@gmail.com
>
上级
5c20a163
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
26 行删除
+28
-26
dnn_sptf.c
theano/gpuarray/c_code/dnn_sptf.c
+28
-26
没有找到文件。
theano/gpuarray/c_code/dnn_sptf.c
浏览文件 @
2f90f3b0
...
@@ -63,14 +63,14 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -63,14 +63,14 @@ dnn_sptf(PyGpuArrayObject * input,
break
;
break
;
default:
default:
PyErr_SetString
(
PyExc_TypeError
,
PyErr_SetString
(
PyExc_TypeError
,
"GpuDnnTransformer: unsupported type in spatial transformer sampler
"
);
"GpuDnnTransformer: unsupported type for input in spatial transformer.
"
);
return
-
1
;
return
-
1
;
}
}
if
(
!
GpuArray_IS_C_CONTIGUOUS
(
&
(
input
->
ga
)
)
)
if
(
!
GpuArray_IS_C_CONTIGUOUS
(
&
(
input
->
ga
)
)
)
{
{
PyErr_SetString
(
PyExc_MemoryError
,
PyErr_SetString
(
PyExc_MemoryError
,
"GpuDnnTransformer: input data is not C-contiguous
"
);
"GpuDnnTransformer: input data is not C-contiguous.
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -78,34 +78,35 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -78,34 +78,35 @@ dnn_sptf(PyGpuArrayObject * input,
theta
->
ga
.
typecode
!=
GA_DOUBLE
&&
theta
->
ga
.
typecode
!=
GA_DOUBLE
&&
theta
->
ga
.
typecode
!=
GA_HALF
)
theta
->
ga
.
typecode
!=
GA_HALF
)
{
{
PyErr_SetString
(
PyExc_TypeError
,
"GpuDnnTransformer: unsupported data type for theta"
);
PyErr_SetString
(
PyExc_TypeError
,
"GpuDnnTransformer: unsupported data type for theta in spatial transformer."
);
return
-
1
;
return
-
1
;
}
}
else
if
(
PyGpuArray_NDIM
(
theta
)
!=
3
)
else
if
(
PyGpuArray_NDIM
(
theta
)
!=
3
)
{
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: theta must have three dimensions!"
);
"GpuDnnTransformer: theta must have three dimensions!"
);
return
-
1
;
return
-
1
;
}
}
else
if
(
PyGpuArray_DIM
(
theta
,
1
)
!=
2
&&
PyGpuArray_DIM
(
theta
,
2
)
!=
3
)
else
if
(
PyGpuArray_DIM
(
theta
,
1
)
!=
2
&&
PyGpuArray_DIM
(
theta
,
2
)
!=
3
)
{
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: incorrect dimensions for theta, expected (%d, %d, %d), got (%d, %d, %d)"
,
"GpuDnnTransformer: incorrect dimensions for theta, expected (%d, %d, %d), got (%d, %d, %d)"
,
PyGpuArray_DIMS
(
theta
)[
0
],
2
,
3
,
PyGpuArray_DIMS
(
theta
)[
0
],
PyGpuArray_DIMS
(
theta
)[
0
],
2
,
3
,
PyGpuArray_DIMS
(
theta
)[
0
],
PyGpuArray_DIMS
(
theta
)[
1
],
PyGpuArray_DIMS
(
theta
)[
2
]
);
PyGpuArray_DIMS
(
theta
)[
1
],
PyGpuArray_DIMS
(
theta
)[
2
]
);
return
-
1
;
return
-
1
;
}
}
else
if
(
!
GpuArray_IS_C_CONTIGUOUS
(
&
(
theta
->
ga
)
)
)
else
if
(
!
GpuArray_IS_C_CONTIGUOUS
(
&
(
theta
->
ga
)
)
)
{
{
PyErr_SetString
(
PyExc_MemoryError
,
PyErr_SetString
(
PyExc_MemoryError
,
"GpuDnnTransformer: theta is not C-contiguous"
);
"GpuDnnTransformer: theta is not C-contiguous"
);
return
-
1
;
return
-
1
;
}
}
if
(
PyArray_NDIM
(
grid_dims
)
!=
1
||
PyArray_SIZE
(
grid_dims
)
!=
4
)
if
(
PyArray_NDIM
(
grid_dims
)
!=
1
||
PyArray_SIZE
(
grid_dims
)
!=
4
)
{
{
PyErr_SetString
(
PyExc_RuntimeError
,
PyErr_SetString
(
PyExc_RuntimeError
,
"GpuDnnTransformer: grid_dims must have 4 elements."
);
"GpuDnnTransformer: grid_dims must have 4 elements."
);
return
-
1
;
return
-
1
;
}
}
...
@@ -119,7 +120,7 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -119,7 +120,7 @@ dnn_sptf(PyGpuArrayObject * input,
if
(
width
==
0
||
height
==
0
||
num_images
==
0
)
if
(
width
==
0
||
height
==
0
||
num_images
==
0
)
{
{
PyErr_SetString
(
PyExc_RuntimeError
,
PyErr_SetString
(
PyExc_RuntimeError
,
"GpuDnnTransformer: grid_dims has a dimension with value zero"
);
"GpuDnnTransformer: grid_dims has a dimension with value zero"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -131,7 +132,7 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -131,7 +132,7 @@ dnn_sptf(PyGpuArrayObject * input,
GA_C_ORDER
,
gpu_ctx
)
!=
0
)
GA_C_ORDER
,
gpu_ctx
)
!=
0
)
{
{
PyErr_SetString
(
PyExc_RuntimeError
,
PyErr_SetString
(
PyExc_RuntimeError
,
"GpuDnnTransformer: could not allocate memory for grid of coordinates"
);
"GpuDnnTransformer: could not allocate memory for grid of coordinates"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -143,8 +144,8 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -143,8 +144,8 @@ dnn_sptf(PyGpuArrayObject * input,
cuda_exit
(
gpu_ctx
->
ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: could not create xdesc: %s"
,
"GpuDnnTransformer: could not create xdesc: %s"
,
cudnnGetErrorString
(
err
)
);
cudnnGetErrorString
(
err
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -159,8 +160,8 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -159,8 +160,8 @@ dnn_sptf(PyGpuArrayObject * input,
if
(
input_num_images
!=
num_images
||
input_num_channels
!=
num_channels
)
if
(
input_num_images
!=
num_images
||
input_num_channels
!=
num_channels
)
{
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: expected input to have %d inputs, got %d inputs."
,
"GpuDnnTransformer: expected input to have %d inputs, got %d inputs."
,
num_images
,
input_num_images
);
num_images
,
input_num_images
);
return
-
1
;
return
-
1
;
}
}
...
@@ -173,8 +174,8 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -173,8 +174,8 @@ dnn_sptf(PyGpuArrayObject * input,
cuda_exit
(
gpu_ctx
->
ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: failed to initialize xdesc: %s"
,
"GpuDnnTransformer: failed to initialize xdesc: %s"
,
cudnnGetErrorString
(
err
)
);
cudnnGetErrorString
(
err
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -186,8 +187,8 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -186,8 +187,8 @@ dnn_sptf(PyGpuArrayObject * input,
cuda_exit
(
gpu_ctx
->
ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: failed to create ydesc: %s"
,
"GpuDnnTransformer: failed to create ydesc: %s"
,
cudnnGetErrorString
(
err
)
);
cudnnGetErrorString
(
err
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -200,8 +201,8 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -200,8 +201,8 @@ dnn_sptf(PyGpuArrayObject * input,
cuda_exit
(
gpu_ctx
->
ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: failed to initialize ydesc: %s"
,
"GpuDnnTransformer: failed to initialize ydesc: %s"
,
cudnnGetErrorString
(
err
)
);
cudnnGetErrorString
(
err
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -214,7 +215,7 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -214,7 +215,7 @@ dnn_sptf(PyGpuArrayObject * input,
cuda_exit
(
gpu_ctx
->
ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
PyErr_SetString
(
PyExc_MemoryError
,
PyErr_SetString
(
PyExc_MemoryError
,
"GpuDnnTransformer: could not allocate memory for grid sampler"
);
"GpuDnnTransformer: could not allocate memory for grid sampler"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -229,8 +230,8 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -229,8 +230,8 @@ dnn_sptf(PyGpuArrayObject * input,
if
(
CUDNN_STATUS_SUCCESS
!=
err
)
if
(
CUDNN_STATUS_SUCCESS
!=
err
)
{
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: failed to create grid of coordinates: %s"
,
"GpuDnnTransformer: failed to create grid of coordinates: %s"
,
cudnnGetErrorString
(
err
)
);
cudnnGetErrorString
(
err
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -245,8 +246,9 @@ dnn_sptf(PyGpuArrayObject * input,
...
@@ -245,8 +246,9 @@ dnn_sptf(PyGpuArrayObject * input,
if
(
CUDNN_STATUS_SUCCESS
!=
err
)
if
(
CUDNN_STATUS_SUCCESS
!=
err
)
{
{
PyErr_SetString
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnTransformer: failed to create grid sampler"
);
"GpuDnnTransformer: failed to create grid sampler: %s"
,
cudnnGetErrorString
(
err
)
);
spatialtf_context_destroy
(
&
spatialtf_ctx
);
spatialtf_context_destroy
(
&
spatialtf_ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
cuda_exit
(
gpu_ctx
->
ctx
);
return
-
1
;
return
-
1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论