Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
151a5dc8
提交
151a5dc8
authored
4月 15, 2010
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GpuElemwise - removed ExternAlgo dead code
上级
5ca50a4f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
0 行增加
和
87 行删除
+0
-87
elemwise.py
theano/sandbox/cuda/elemwise.py
+0
-87
没有找到文件。
theano/sandbox/cuda/elemwise.py
浏览文件 @
151a5dc8
...
@@ -906,90 +906,3 @@ nd_collapse_[i]=0;
...
@@ -906,90 +906,3 @@ nd_collapse_[i]=0;
#define INTMOD_POW2(a, b) (a & ((1<<b)-1))
#define INTMOD_POW2(a, b) (a & ((1<<b)-1))
"""
"""
class
ExternAlgo
(
object
):
def
externalgo_c_support_code_apply
(
self
,
node
,
nodename
):
nd
=
node
.
outputs
[
0
]
.
type
.
ndim
n_inputs
=
len
(
node
.
inputs
)
n_outputs
=
len
(
node
.
outputs
)
id_self
=
id
(
self
)
d
=
dict
()
#input_params and output_params go into the function declaration/definition
input_params
=
", "
.
join
(
"const float * i
%
i_data, const int * i
%
i_str"
%
(
ipos
,
ipos
)
for
ipos
in
xrange
(
len
(
node
.
inputs
)))
output_params
=
", "
.
join
(
"float * o
%
i_data, const int * o
%
i_str"
%
(
ipos
,
ipos
)
for
ipos
in
xrange
(
len
(
node
.
outputs
)))
#input_args and output_args go into the recursive call.
input_args
=
", "
.
join
(
"i
%
i_data, i
%
i_str"
%
(
ipos
,
ipos
)
for
ipos
in
xrange
(
len
(
node
.
inputs
)))
output_args
=
", "
.
join
(
"o
%
i_data, o
%
i_str"
%
(
ipos
,
ipos
)
for
ipos
in
xrange
(
len
(
node
.
outputs
)))
prod_dims
=
'*'
.
join
(
"dims[
%
i]"
%
di
for
di
in
xrange
(
nd
))
scalar_op
=
self
.
scalar_op
.
__class__
.
__name__
apply_task_code
=
self
.
scalar_op
.
c_code
(
Apply
(
self
.
scalar_op
,
[
scalar
.
Scalar
(
dtype
=
input
.
type
.
dtype
)()
for
input
in
node
.
inputs
],
[
scalar
.
Scalar
(
dtype
=
output
.
type
.
dtype
)()
for
output
in
node
.
outputs
])
,
nodename
+
'_scalar_'
,
[
'x[
%
i][0]'
%
ipos
for
ipos
,
i
in
enumerate
(
node
.
inputs
)]
,
[
'z[
%
i][0]'
%
ipos
for
ipos
,
i
in
enumerate
(
node
.
outputs
)]
,
sub
=
dict
(
fail
=
'return;'
))
#TODO: set a failure code somehow!!!
### NOTE WELL: log2_dims is not initialized on input to this function... it is meant as
### storage space where the log2_dims *could* be computed and stored.
sio
=
StringIO
.
StringIO
()
print
>>
sio
,
"""
#include "elemwise.cuh"
template <int nx, typename Tx, int nz, typename Tz>
class ElemwiseFn_
%(scalar_op)
s
{
public:
static __device__ void apply(const Tx**x, Tz**z)
{
%(apply_task_code)
s
}
};
static void callkernel_
%(nodename)
s(unsigned int numEls, const int d,
const int * dims, const int * log2_dims,
%(input_params)
s,
%(output_params)
s)
{
const float * inputs[
%(n_inputs)
s];
float * outputs[
%(n_outputs)
s];
const int * input_strides[
%(n_inputs)
s];
const int * output_strides[
%(n_inputs)
s];
"""
%
locals
()
for
ipos
,
i
in
enumerate
(
node
.
inputs
):
print
>>
sio
,
"""
inputs[
%(ipos)
s] = i
%(ipos)
s_data;
input_strides[
%(ipos)
s] = i
%(ipos)
s_str;
"""
%
locals
()
for
ipos
,
i
in
enumerate
(
node
.
outputs
):
print
>>
sio
,
"""
outputs[
%(ipos)
s] = o
%(ipos)
s_data;
output_strides[
%(ipos)
s] = o
%(ipos)
s_str;
"""
%
locals
()
print
>>
sio
,
"""
cnda_elemwise<float, float,
ElemwiseFn_
%(scalar_op)
s<
%(n_inputs)
s, typeof(i0_data[0]),
%(n_outputs)
s, typeof(o0_data[0])>
,
%(n_inputs)
s,
%(n_outputs)
s,
%(nd)
s> (
dims,
inputs,
input_strides,
outputs,
output_strides
);
}
"""
%
locals
()
print
sio
.
getvalue
()
return
sio
.
getvalue
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论