Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7bc63958
提交
7bc63958
authored
6月 24, 2017
作者:
João Victor Tozatti Risso
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix memory initialization for grid of coordinates in spatialtf_grid
Signed-off-by:
João Victor Tozatti Risso
<
joaovictor.risso@gmail.com
>
上级
1c155e5f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
6 行删除
+17
-6
spatialtf_grid.c
theano/gpuarray/c_code/spatialtf_grid.c
+17
-6
没有找到文件。
theano/gpuarray/c_code/spatialtf_grid.c
浏览文件 @
7bc63958
#section support_code
#section support_code
int
int
spatialtf_grid
(
cudnnSpatialTransformerDescriptor_t
desc
,
spatialtf_grid
(
PyGpuArrayObject
*
theta
,
PyGpuArrayObject
*
theta
,
PyArrayObject
*
grid_dimensions
,
PyArrayObject
*
grid_dimensions
,
cudnnSpatialTransformerDescriptor_t
desc
,
PyGpuArrayObject
**
grid
,
PyGpuArrayObject
**
grid
,
cudnnHandle_t
_handle
)
cudnnHandle_t
_handle
)
{
{
...
@@ -18,7 +18,7 @@ spatialtf_grid(cudnnSpatialTransformerDescriptor_t desc,
...
@@ -18,7 +18,7 @@ spatialtf_grid(cudnnSpatialTransformerDescriptor_t desc,
return
-
1
;
return
-
1
;
}
}
if
(
PyArray_
NDIM
(
grid_dimensions
)
<
4
)
if
(
PyArray_
DIM
(
grid_dimensions
,
0
)
<
4
)
{
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"Grid dimensions array must have at least 4 dimensions!"
);
"Grid dimensions array must have at least 4 dimensions!"
);
...
@@ -34,13 +34,24 @@ spatialtf_grid(cudnnSpatialTransformerDescriptor_t desc,
...
@@ -34,13 +34,24 @@ spatialtf_grid(cudnnSpatialTransformerDescriptor_t desc,
// Grid of coordinates is of size num_images * height * width * 2 for a 2D transformation
// Grid of coordinates is of size num_images * height * width * 2 for a 2D transformation
const
size_t
grid_dims
[
4
]
=
{
width
,
height
,
2
,
num_images
};
const
size_t
grid_dims
[
4
]
=
{
width
,
height
,
2
,
num_images
};
if
(
theano_prep_output
(
grid
,
4
,
&
(
grid_dims
[
0
]),
theta
->
ga
.
typecode
,
if
(
width
==
0
||
height
==
0
||
num_images
==
0
)
GA_C_ORDER
,
gpu_ctx
)
!=
0
)
{
PyErr_Format
(
PyExc_RuntimeError
,
"Invalid grid dimensions!"
);
return
-
1
;
}
if
(
NULL
==
*
grid
)
{
*
grid
=
pygpu_zeros
(
4
,
&
(
grid_dims
[
0
]),
theta
->
ga
.
typecode
,
GA_C_ORDER
,
gpu_ctx
,
Py_None
);
if
(
NULL
==
*
grid
)
{
{
PyErr_SetString
(
PyExc_MemoryError
,
PyErr_SetString
(
PyExc_MemoryError
,
"Could not allocate memory for the
grid of coordinates"
);
"Could not allocate memory for
grid of coordinates"
);
return
-
1
;
return
-
1
;
}
}
}
const
void
*
theta_data
=
PyGpuArray_DEV_DATA
(
theta
);
const
void
*
theta_data
=
PyGpuArray_DEV_DATA
(
theta
);
void
*
grid_data
=
PyGpuArray_DEV_DATA
(
*
grid
);
void
*
grid_data
=
PyGpuArray_DEV_DATA
(
*
grid
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论