Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
de2689f2
提交
de2689f2
authored
7月 15, 2014
作者:
Roy Xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:
Add TensorConstant check in check_node_state method.
上级
441f01cf
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
3 行删除
+13
-3
profiling.py
theano/compile/profiling.py
+13
-3
没有找到文件。
theano/compile/profiling.py
浏览文件 @
de2689f2
...
@@ -24,6 +24,7 @@ from collections import defaultdict
...
@@ -24,6 +24,7 @@ from collections import defaultdict
import
numpy
import
numpy
import
theano
import
theano
from
theano.gof
import
Constant
from
theano.configparser
import
AddConfigVar
,
BoolParam
,
IntParam
from
theano.configparser
import
AddConfigVar
,
BoolParam
,
IntParam
...
@@ -702,9 +703,12 @@ class ProfileStats(object):
...
@@ -702,9 +703,12 @@ class ProfileStats(object):
compute_map
=
defaultdict
(
lambda
:
[
0
])
compute_map
=
defaultdict
(
lambda
:
[
0
])
# compute_map use to check if a node is valid
# compute_map use to check if a node is valid
for
node
in
node_list
:
# for node in node_list:
for
val
in
node
.
inputs
:
# for val in node.inputs:
compute_map
[
val
][
0
]
=
1
# compute_map[val][0] = 1
for
node
in
fgraph
.
inputs
:
compute_map
[
node
][
0
]
=
1
print
fgraph
.
outputs
def
check_node_state
(
node
):
def
check_node_state
(
node
):
"""
"""
...
@@ -715,6 +719,9 @@ class ProfileStats(object):
...
@@ -715,6 +719,9 @@ class ProfileStats(object):
inputs
=
node
.
inputs
inputs
=
node
.
inputs
outputs
=
node
.
outputs
outputs
=
node
.
outputs
deps
=
inputs
+
node
.
destroy_dependencies
deps
=
inputs
+
node
.
destroy_dependencies
for
node
in
deps
:
if
isinstance
(
node
,
Constant
):
compute_map
[
node
][
0
]
=
1
computed_ins
=
all
(
compute_map
[
v
][
0
]
for
v
in
inputs
)
computed_ins
=
all
(
compute_map
[
v
][
0
]
for
v
in
inputs
)
computed_outs
=
all
(
compute_map
[
v
][
0
]
for
v
in
outputs
)
computed_outs
=
all
(
compute_map
[
v
][
0
]
for
v
in
outputs
)
# check if there could be a compute_map
# check if there could be a compute_map
...
@@ -736,6 +743,9 @@ class ProfileStats(object):
...
@@ -736,6 +743,9 @@ class ProfileStats(object):
for
i
in
range
(
len
(
node_list
)):
for
i
in
range
(
len
(
node_list
)):
v
=
node_list
[
i
:
i
+
1
]
v
=
node_list
[
i
:
i
+
1
]
if
check_node_state
(
v
[
0
]):
if
check_node_state
(
v
[
0
]):
# print v[0].inputs
# print v[0].outputs
# print compute_map
for
node
in
v
[
0
]
.
outputs
:
for
node
in
v
[
0
]
.
outputs
:
compute_map
[
node
][
0
]
=
1
compute_map
[
node
][
0
]
=
1
if
len
(
node_list
)
==
1
:
if
len
(
node_list
)
==
1
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论