Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
97ab0274
提交
97ab0274
authored
7月 09, 2015
作者:
ChienliMa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Codes should handle node with all Constant inputs
上级
9b635db7
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
3 行删除
+6
-3
builders.py
theano/compile/builders.py
+3
-1
test_builders.py
theano/compile/tests/test_builders.py
+3
-2
没有找到文件。
theano/compile/builders.py
浏览文件 @
97ab0274
...
@@ -150,7 +150,7 @@ class OpFromGraph(gof.Op):
...
@@ -150,7 +150,7 @@ class OpFromGraph(gof.Op):
c_map
=
{}
c_map
=
{}
num_of_input
=
len
(
fgraph
.
inputs
)
num_of_input
=
len
(
fgraph
.
inputs
)
# Initialize input connection pattern, each input affects itself
# Initialize input connection pattern, each input affects itself
for
index
in
range
(
num_of_input
):
for
index
in
x
range
(
num_of_input
):
vec
=
[
False
]
*
num_of_input
vec
=
[
False
]
*
num_of_input
vec
[
index
]
=
True
vec
[
index
]
=
True
# Make use of numpy.array to simplify codes
# Make use of numpy.array to simplify codes
...
@@ -163,6 +163,8 @@ class OpFromGraph(gof.Op):
...
@@ -163,6 +163,8 @@ class OpFromGraph(gof.Op):
for
var
in
node
.
inputs
:
for
var
in
node
.
inputs
:
if
not
isinstance
(
var
,
theano
.
Constant
):
if
not
isinstance
(
var
,
theano
.
Constant
):
in_vecs
.
append
(
c_map
[
var
])
in_vecs
.
append
(
c_map
[
var
])
else
:
in_vecs
.
append
(
numpy
.
array
([
False
]
*
num_of_input
))
if
not
hasattr
(
node
.
op
,
'connection_pattern'
):
if
not
hasattr
(
node
.
op
,
'connection_pattern'
):
# By default, nodes inputs affect all outputs
# By default, nodes inputs affect all outputs
...
...
theano/compile/tests/test_builders.py
浏览文件 @
97ab0274
...
@@ -145,9 +145,10 @@ class T_OpFromGraph(unittest.TestCase):
...
@@ -145,9 +145,10 @@ class T_OpFromGraph(unittest.TestCase):
out3
=
3
+
rv_u
out3
=
3
+
rv_u
op3
=
OpFromGraph
([
x
,
y
],
[
out1
,
out2
,
out3
],
mode
=
'FAST_RUN'
)
op3
=
OpFromGraph
([
x
,
y
],
[
out1
,
out2
,
out3
],
mode
=
'FAST_RUN'
)
results
=
op
2
.
connection_pattern
(
None
)
results
=
op
3
.
connection_pattern
(
None
)
expect_result
=
[[
True
,
False
,
False
],
expect_result
=
[[
True
,
False
,
False
],
[
False
,
True
,
False
]]
[
False
,
True
,
False
],
[
True
,
False
,
True
]]
assert
results
==
expect_result
assert
results
==
expect_result
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论