Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9ab1e4d0
提交
9ab1e4d0
authored
7月 31, 2013
作者:
Ludwig Schmidt-Hackenberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
moved init of stack variables to prevent error: jump to label ‘__label_9’…
moved init of stack variables to prevent error: jump to label ‘__label_9’ crosses initialization of ‘shape_%(cdna)s[nd]’
上级
30e1a261
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
14 行删除
+18
-14
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+18
-14
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
9ab1e4d0
...
@@ -2957,9 +2957,11 @@ class GpuJoin(tensor.Join, GpuOp):
...
@@ -2957,9 +2957,11 @@ class GpuJoin(tensor.Join, GpuOp):
str
=
"""
str
=
"""
int axis = PyInt_AsLong((PyObject*)
%(axis)
s);
int axis = PyInt_AsLong((PyObject*)
%(axis)
s);
int nd =
%(nd)
s;
int nd =
%(nd)
s;
int shape_
%(input_1)
s[
%(nd)
s
];
int shape_
%(input_1)
s[
nd
];
int shape_out[
%(nd)
s
];
int shape_out[
nd
];
int width_sum = 0;
int width_sum = 0;
int errorcode;
int sum;
for(int i = 0; i<nd; i+=1)
for(int i = 0; i<nd; i+=1)
{
{
...
@@ -2971,47 +2973,49 @@ class GpuJoin(tensor.Join, GpuOp):
...
@@ -2971,47 +2973,49 @@ class GpuJoin(tensor.Join, GpuOp):
# getting the shapes of all the involved tensors (input[1:])
# getting the shapes of all the involved tensors (input[1:])
# + check: all input tensors have same shape as final out
# + check: all input tensors have same shape as final out
# execept for "axis" dimension
# execept for "axis" dimension
# shape_%(cdna)s[nd] is initialized before, to prevent following
# error: jump to label ‘__label_9’ crosses initialization of
# ‘shape_%(cdna)s[nd]’
for
i
,
cdna
in
enumerate
(
inputs
[
2
:]):
str
+=
"""
int shape_
%(cdna)
s[nd];
"""
%
locals
()
for
i
,
cdna
in
enumerate
(
inputs
[
2
:]):
for
i
,
cdna
in
enumerate
(
inputs
[
2
:]):
str
+=
"""
str
+=
"""
int shape_
%(cdna)
s[
%(nd)
s];
for(int i = 0; i<nd; i+=1)
for(int i = 0; i<nd; i+=1)
{
{
shape_
%(cdna)
s[i] = CudaNdarray_HOST_DIMS(
%(cdna)
s)[i];
shape_
%(cdna)
s[i] = CudaNdarray_HOST_DIMS(
%(cdna)
s)[i];
if((i!=axis) && (shape_
%(cdna)
s[i]!=shape_out[i]))
if((i!=axis) && (shape_
%(cdna)
s[i]!=shape_out[i]))
{
{
// compilation error when `fail`-string is added
// compilation error when `fail`-string is added
%(fail)
s;
}
}
}
}
"""
%
locals
()
"""
%
locals
()
# computing the new shape for the out tensors
# computing the new shape for the out tensors
for
i
,
cdna
in
enumerate
(
inputs
[
1
:]):
for
i
,
cdna
in
enumerate
(
inputs
[
1
:]):
str
+=
"
\t\t
width_sum += CudaNdarray_HOST_DIMS(
%(cdna)
s)[axis];
\n
"
%
locals
()
str
+=
"
\t\t
width_sum += CudaNdarray_HOST_DIMS(
%(cdna)
s)[axis];
\n
"
%
locals
()
str
+=
"
\t\t
shape_out[axis] = width_sum;
\n
"
str
+=
"
\t\t
shape_out[axis] = width_sum;
\n
"
# preparing the output array + init of the necessary variables
# for the data transfer
str
+=
"""
str
+=
"""
if (CudaNdarray_prep_output(&
%(out)
s, nd, shape_out))
if (CudaNdarray_prep_output(&
%(out)
s, nd, shape_out))
{
{
%(fail)
s;
%(fail)
s;
}
}
PyObject *slice_tuple;
PyObject *section_slice;
PyObject *full_slice;
full_slice = PySlice_New(NULL, NULL, NULL);
PyObject *out_sub;
PyObject *out_sub;
PyObject *start, *stop, *step;
PyObject *start, *stop, *step;
step = NULL;
step = NULL;
int errorcode;
int sum;
sum = 0;
sum = 0;
start = NULL;
start = NULL;
PyObject *slice_tuple;
PyObject *section_slice;
PyObject *full_slice;
full_slice = PySlice_New(NULL, NULL, NULL);
"""
%
locals
()
"""
%
locals
()
# start copying the data into the new out tensors
# start copying the data into the new out tensors
for
i
,
cdna
in
enumerate
(
inputs
[
1
:]):
for
i
,
cdna
in
enumerate
(
inputs
[
1
:]):
str
+=
"""
str
+=
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论