Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0aee4085
提交
0aee4085
authored
9月 17, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
made c_code_cache_version work with GpuCAReduce
上级
0478beb3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
25 行增加
和
3 行删除
+25
-3
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+10
-3
basic.py
theano/scalar/basic.py
+15
-0
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
0aee4085
...
@@ -1501,9 +1501,16 @@ class GpuCAReduce(GpuOp):
...
@@ -1501,9 +1501,16 @@ class GpuCAReduce(GpuOp):
"""
%
locals
()
"""
%
locals
()
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
# TODO: make this act like tensor.elemwise.CAReduce
op_version
=
self
.
scalar_op
.
cuda_assign_reduce_code_cache_version
()
# needs to include scalar op's cache version in the returned tuple
if
op_version
:
return
()
# our version is 0
rval
=
[
0
]
rval
.
extend
(
op_version
)
rval
=
tuple
(
rval
)
return
rval
else
:
# we can't support caching if the op doesn't
return
()
def
_op_guard
(
self
):
def
_op_guard
(
self
):
""" Raises NotImplementedError if op is not Add """
""" Raises NotImplementedError if op is not Add """
...
...
theano/scalar/basic.py
浏览文件 @
0aee4085
...
@@ -823,6 +823,12 @@ class ScalarOp(Op):
...
@@ -823,6 +823,12 @@ class ScalarOp(Op):
raise
NotImplementedError
(
raise
NotImplementedError
(
str
(
self
)
+
" does not implement cuda_assign_reduce"
)
str
(
self
)
+
" does not implement cuda_assign_reduce"
)
def
cuda_assign_reduce_code_cache_version
(
self
):
""" Returns a tuple of integers representing the version of the
scalar op's cuda_assign_reduce method. Must be unique across ops.
An empty tuple means not to use code caching for this op"""
return
()
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
4
,)
return
(
4
,)
...
@@ -1169,6 +1175,10 @@ class Maximum(BinaryScalarOp):
...
@@ -1169,6 +1175,10 @@ class Maximum(BinaryScalarOp):
def
cuda_assign_reduce
(
self
,
left
,
right
):
def
cuda_assign_reduce
(
self
,
left
,
right
):
return
left
+
' = max('
+
left
+
', '
+
right
+
');'
return
left
+
' = max('
+
left
+
', '
+
right
+
');'
def
cuda_assign_reduce_code_cache_version
(
self
):
# Maximum's unique identifier is 0
# Version 0 of its code
return
(
0
,
0
)
maximum
=
Maximum
(
upcast_out
,
name
=
'maximum'
)
maximum
=
Maximum
(
upcast_out
,
name
=
'maximum'
)
...
@@ -1235,6 +1245,11 @@ class Add(ScalarOp):
...
@@ -1235,6 +1245,11 @@ class Add(ScalarOp):
def
cuda_assign_reduce
(
self
,
left
,
right
):
def
cuda_assign_reduce
(
self
,
left
,
right
):
return
left
+
' += '
+
right
+
';'
return
left
+
' += '
+
right
+
';'
def
cuda_assign_reduce_code_cache_version
(
self
):
# Add's unique identifier is 1
# Version 0 of its code
return
(
1
,
0
)
add
=
Add
(
upcast_out
,
name
=
'add'
)
add
=
Add
(
upcast_out
,
name
=
'add'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论