Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4f13132c
提交
4f13132c
authored
6月 07, 2013
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1405 from HapeMask/py3k-fixes
Py3k fixes
上级
297f927d
c4aa115d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
18 行增加
和
20 行删除
+18
-20
cutils.py
theano/gof/cutils.py
+1
-0
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+5
-5
elemwise.py
theano/sandbox/cuda/elemwise.py
+11
-14
elemwise.py
theano/tensor/elemwise.py
+1
-1
没有找到文件。
theano/gof/cutils.py
浏览文件 @
4f13132c
...
...
@@ -230,6 +230,7 @@ fail:
PyMODINIT_FUNC
PyInit_cutils_ext(void) {
import_array();
return PyModule_Create(&moduledef);
}
}
...
...
theano/sandbox/cuda/basic_ops.py
浏览文件 @
4f13132c
...
...
@@ -1133,10 +1133,10 @@ class GpuCAReduce(GpuOp):
assert
N
in
[
1
,
2
,
3
]
makecall
=
self
.
_makecall
(
node
,
name
,
x
,
z
,
fail
)
N_pattern
=
''
.
join
([
'1'
]
*
N
)
param_dim
=
","
.
join
([
"CudaNdarray_HOST_DIMS(
%
(x)
s)[
%(i)
s]"
%
locals
(
)
param_dim
=
","
.
join
([
"CudaNdarray_HOST_DIMS(
%
s)[
%
d]"
%
(
x
,
i
)
for
i
in
xrange
(
N
+
1
)])
strides_dim
=
","
.
join
([
"CudaNdarray_HOST_STRIDES(
%
(x)
s)[
%(i)
s
]"
%
locals
(
)
for
i
in
xrange
(
N
+
1
)])
strides_dim
=
","
.
join
([
"CudaNdarray_HOST_STRIDES(
%
s)[
%
d
]"
%
(
x
,
i
)
for
i
in
xrange
(
N
+
1
)])
threads_y
=
"""
//get as many y threads as we can fit
...
...
@@ -1728,9 +1728,9 @@ class GpuCAReduce(GpuOp):
sA3
=
'sA3'
reducebuf
=
self
.
_k_reduce_buf
(
'Z[i0 * sZ0]'
,
node
,
nodename
,
sub
=
{})
param_dim
=
","
.
join
([
"const int d
%
(i)
s"
%
locals
()
param_dim
=
","
.
join
([
"const int d
%
d"
%
i
for
i
in
xrange
(
nd_in
)])
param_strides
=
","
.
join
([
"const int sA
%
(i)
s"
%
locals
()
param_strides
=
","
.
join
([
"const int sA
%
d"
%
i
for
i
in
xrange
(
nd_in
)])
decl
=
self
.
_k_decl
(
node
,
nodename
)
init
=
self
.
_k_init
(
node
,
nodename
)
...
...
theano/sandbox/cuda/elemwise.py
浏览文件 @
4f13132c
...
...
@@ -600,9 +600,11 @@ class NaiveAlgo(object):
print
>>
sio
,
'std::cerr << "
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
print
>>
sio
,
'std::cerr << " local_str inputs
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%(ipos)
s][
%(x)
s]"
%
locals
()
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_str inputs
%(ipos)
s: " <<'
%
locals
()
+
\
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
print
>>
sio
,
'std::cerr << " local_ostr inputs
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%(ipos)
s][
%(x)
s]"
%
locals
()
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_ostr inputs
%(ipos)
s: " <<'
%
locals
()
+
\
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
"""
for(int id=0;id<nd_collapse;id++){
...
...
@@ -641,9 +643,9 @@ class NaiveAlgo(object):
print
>>
sio
,
'std::cerr << "
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
(ipos)
s][
%(x)
s]"
%
locals
(
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
(ipos)
s][
%(x)
s]"
%
locals
(
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
# collapse contiguous dimensions (ignoring scalars, generic version(collapse any dimensions, right, left, middle))
# this is a good idea because we make less index calculation in the gpu.
...
...
@@ -670,12 +672,7 @@ nd_collapse_[i]=0;
print
>>
sio
,
"""
std::cerr<< "nd_collapse_
%(ipos)
s "<<
"""
%
locals
()
print
>>
sio
,
' << " " << '
.
join
([
"nd_collapse_
%(ipos)
s["
%
locals
()
+
str
(
i
)
+
"]"
for
i
in
xrange
(
nd
)])
print
>>
sio
,
'<< "
\\
n";'
print
>>
sio
,
"""
std::cerr<< "nd_collapse_ "<<
"""
%
locals
()
print
>>
sio
,
' << " " << '
.
join
([
"nd_collapse_["
%
locals
()
+
str
(
i
)
+
"]"
for
i
in
xrange
(
nd
)])
print
>>
sio
,
' << " " << '
.
join
([
"nd_collapse_
%
s["
%
ipos
+
str
(
i
)
+
"]"
for
i
in
xrange
(
nd
)])
print
>>
sio
,
'<< "
\\
n";'
# update the local stride.
...
...
@@ -719,8 +716,8 @@ nd_collapse_[i]=0;
if(nd_collapse_[i]==1)nd_collapse--;
}
if(nd_collapse == 1 """
%
locals
()
l
=
[
"local_str[
%
(ipos)
s][nd_collapse-1]==1 "
%
locals
()
for
ipos
in
xrange
(
len
(
node
.
inputs
))
if
not
_logical_scalar
(
node
.
inputs
[
ipos
])]
l
+=
[
"local_ostr[
%
(ipos)
s][nd_collapse-1]==1 "
%
locals
()
for
ipos
in
xrange
(
len
(
node
.
outputs
))
if
not
_logical_scalar
(
node
.
outputs
[
ipos
])]
l
=
[
"local_str[
%
s][nd_collapse-1]==1 "
%
ipos
for
ipos
in
xrange
(
len
(
node
.
inputs
))
if
not
_logical_scalar
(
node
.
inputs
[
ipos
])]
l
+=
[
"local_ostr[
%
s][nd_collapse-1]==1 "
%
ipos
for
ipos
in
xrange
(
len
(
node
.
outputs
))
if
not
_logical_scalar
(
node
.
outputs
[
ipos
])]
if
len
(
l
)
>
0
:
print
>>
sio
,
" && "
,
" && "
.
join
(
l
)
print
>>
sio
,
"""){nd_collapse=0;} """
...
...
@@ -734,9 +731,9 @@ nd_collapse_[i]=0;
print
>>
sio
,
'std::cerr << "
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
inputs
)):
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
(ipos)
s][
%(x)
s]"
%
locals
(
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_str
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_str[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
for
ipos
in
xrange
(
len
(
node
.
outputs
)):
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
(ipos)
s][
%(x)
s]"
%
locals
(
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
print
>>
sio
,
'std::cerr << " local_ostr
%(ipos)
s: " <<'
%
locals
()
+
' << " " << '
.
join
([
"local_ostr[
%
s][
%
s]"
%
(
ipos
,
x
)
for
x
in
xrange
(
nd
)])
+
'<<"
\\
n";'
def
launch_Ccontiguous
(
nodename
,
scalar_op
,
sync
=
True
):
...
...
theano/tensor/elemwise.py
浏览文件 @
4f13132c
...
...
@@ -1074,7 +1074,7 @@ class Elemwise(Op):
# the element-wise computation. Aliased scalar variables need
# not be declared, as they are #defined in defines
task_decl
=
""
.
join
([
"
%
(dtype)
s&
%(name)
s_i = *
%(name)
s_iter;
\n
"
%
locals
(
)
"
%
s&
%
s_i = *
%
s_iter;
\n
"
%
(
dtype
,
name
,
name
)
for
name
,
dtype
in
izip
(
inames
+
list
(
real_onames
),
idtypes
+
list
(
real_odtypes
))])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论