Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d4f7d749
提交
d4f7d749
authored
6月 13, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some small comments from review.
上级
b33b4462
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
8 行删除
+14
-8
extending_theano_gpu.txt
doc/extending/extending_theano_gpu.txt
+4
-1
basic_ops.py
theano/gpuarray/basic_ops.py
+10
-7
没有找到文件。
doc/extending/extending_theano_gpu.txt
浏览文件 @
d4f7d749
...
@@ -72,7 +72,10 @@ The last place where you might need the context is in the C
...
@@ -72,7 +72,10 @@ The last place where you might need the context is in the C
initialization code. For that you will have to use the :ref:`params
initialization code. For that you will have to use the :ref:`params
<extending_op_params>`. The params type should be
<extending_op_params>`. The params type should be
:class:`theano.gpuarray.type.gpu_context_type` and the params object
:class:`theano.gpuarray.type.gpu_context_type` and the params object
should be a context object from one of your input variables.
should be a context object from one of your input variables::
def get_params(self, node):
return node.inputs[0].type.context
If you don't have any input variables on the GPU you can follow the
If you don't have any input variables on the GPU you can follow the
the example of :class:`theano.gpuarray.basic_ops.GpuFromHost` or
the example of :class:`theano.gpuarray.basic_ops.GpuFromHost` or
...
...
theano/gpuarray/basic_ops.py
浏览文件 @
d4f7d749
...
@@ -162,10 +162,13 @@ class Kernel(object):
...
@@ -162,10 +162,13 @@ class Kernel(object):
dictionary of flags
dictionary of flags
codevar: str
codevar: str
the name of the variable for the code object.
the name of the variable for the code object.
(defaults to 'kcode_' + name)
binvar: str
binvar: str
the name of the variable for the binary object.
the name of the variable for the binary object.
(defaults to 'kbin_' + name)
objvar: str
objvar: str
the name of the variable for the kernel object.
the name of the variable for the kernel object.
(defaults to 'k_' + name)
"""
"""
...
@@ -362,7 +365,7 @@ class GpuKernelBase(object):
...
@@ -362,7 +365,7 @@ class GpuKernelBase(object):
return
(
4
,
self
.
get_params
(
node
)
.
bin_id
)
return
(
4
,
self
.
get_params
(
node
)
.
bin_id
)
def
f
wds
(
name
):
def
f
orward_string_meth
(
name
):
def
f
(
*
args
):
def
f
(
*
args
):
res
=
getattr
(
GpuKernelBase
,
name
)(
*
args
)
res
=
getattr
(
GpuKernelBase
,
name
)(
*
args
)
try
:
try
:
...
@@ -386,11 +389,11 @@ class CGpuKernelBase(COp, GpuKernelBase):
...
@@ -386,11 +389,11 @@ class CGpuKernelBase(COp, GpuKernelBase):
kernel_re
=
re
.
compile
(
r'^#kernel ([a-zA-Z_].*?)$'
,
re
.
MULTILINE
)
kernel_re
=
re
.
compile
(
r'^#kernel ([a-zA-Z_].*?)$'
,
re
.
MULTILINE
)
c_support_code
=
f
wds
(
'c_support_code'
)
c_support_code
=
f
orward_string_meth
(
'c_support_code'
)
c_support_code_apply
=
f
wds
(
'c_support_code_apply'
)
c_support_code_apply
=
f
orward_string_meth
(
'c_support_code_apply'
)
c_support_code_struct
=
f
wds
(
'c_support_code_struct'
)
c_support_code_struct
=
f
orward_string_meth
(
'c_support_code_struct'
)
c_init_code_struct
=
f
wds
(
'c_init_code_struct'
)
c_init_code_struct
=
f
orward_string_meth
(
'c_init_code_struct'
)
c_cleanup_code_struct
=
f
wds
(
'c_cleanup_code_struct'
)
c_cleanup_code_struct
=
f
orward_string_meth
(
'c_cleanup_code_struct'
)
def
_type_macros
(
self
,
node
):
def
_type_macros
(
self
,
node
):
define_template
=
"#define
%
s
%
s"
define_template
=
"#define
%
s
%
s"
...
@@ -428,7 +431,7 @@ class CGpuKernelBase(COp, GpuKernelBase):
...
@@ -428,7 +431,7 @@ class CGpuKernelBase(COp, GpuKernelBase):
res
=
[]
res
=
[]
while
n
<
len
(
split
):
while
n
<
len
(
split
):
kspec
=
split
[
n
]
kspec
=
split
[
n
]
kcode
=
split
[
n
+
1
]
kcode
=
split
[
n
+
1
]
splt2
=
kspec
.
split
(
':'
)
splt2
=
kspec
.
split
(
':'
)
if
len
(
splt2
)
!=
3
:
if
len
(
splt2
)
!=
3
:
raise
ValueError
(
"Bad kernel spec:
%
s"
%
(
kspec
,))
raise
ValueError
(
"Bad kernel spec:
%
s"
%
(
kspec
,))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论