Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f56254ef
提交
f56254ef
authored
10月 29, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1036 from nouiz/gpu_elem_opt
Fix an optimization crash of local_gpu_elemwise_0.
上级
a436a549
2ee61c0d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
1 行删除
+27
-1
basic.py
theano/scalar/basic.py
+7
-1
test_basic.py
theano/scalar/tests/test_basic.py
+20
-0
没有找到文件。
theano/scalar/basic.py
浏览文件 @
f56254ef
...
...
@@ -2725,11 +2725,17 @@ class Composite(ScalarOp):
return
super
(
Composite
,
self
)
.
make_node
(
*
inputs
)
else
:
# Make a new op with the right input type.
assert
len
(
inputs
)
==
self
.
nin
res
=
theano
.
compile
.
rebuild_collect_shared
(
self
.
outputs
,
replace
=
dict
(
zip
(
self
.
inputs
,
inputs
)),
rebuild_strict
=
False
)
node
=
Composite
(
inputs
,
res
[
1
])
.
make_node
(
*
inputs
)
# After rebuild_collect_shared, the Variable in inputs
# are not necessarily in the graph represented by res.
# res[2][0] is a dict that map from the original variable to the
# cloned variable.
cloned_inputs
=
[
res
[
2
][
0
][
i
]
for
i
in
inputs
]
node
=
Composite
(
cloned_inputs
,
res
[
1
])
.
make_node
(
*
inputs
)
return
node
def
perform
(
self
,
node
,
inputs
,
output_storage
):
...
...
theano/scalar/tests/test_basic.py
浏览文件 @
f56254ef
...
...
@@ -101,6 +101,26 @@ class test_composite(unittest.TestCase):
fn
=
gof
.
DualLinker
()
.
accept
(
g
)
.
make_function
()
assert
fn
(
1.0
,
2.0
,
3.0
)
==
[
6.0
,
7.0
,
0.5
]
def
test_make_node_continue_graph
(
self
):
# This is a test for a bug (now fixed) that disabled the
# local_gpu_elemwise_0 optimization and printed an
# optimization warning on the terminal.
# We test that Composite.make_node accept as inputs Variable
# some that represent existing computation.
si0
=
theano
.
scalar
.
int8
()
si1
=
theano
.
scalar
.
int8
()
si2
=
theano
.
scalar
.
float32
()
sout
=
(
si0
*
si1
)
/
si2
sop
=
theano
.
scalar
.
Composite
([
si0
,
si1
,
si2
],
[
sout
])
si0
=
theano
.
scalar
.
int8
()
si1
=
theano
.
scalar
.
int8
()
si2
=
theano
.
scalar
.
float32
()
si3
=
theano
.
scalar
.
float32
()
sop
.
make_node
(
si0
*
si3
,
si1
,
si2
)
class
test_logical
(
unittest
.
TestCase
):
def
test_gt
(
self
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论