Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e7cb39cb
提交
e7cb39cb
authored
10月 31, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
76d02f64
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
10 行删除
+14
-10
printing.py
theano/printing.py
+14
-10
没有找到文件。
theano/printing.py
浏览文件 @
e7cb39cb
...
@@ -107,8 +107,9 @@ def debugprint(obj, depth=-1, print_type=False,
...
@@ -107,8 +107,9 @@ def debugprint(obj, depth=-1, print_type=False,
scan_ops
=
[]
scan_ops
=
[]
for
r
in
results_to_print
:
for
r
in
results_to_print
:
#Add the parent scan op to the list as well
# Add the parent scan op to the list as well
if
hasattr
(
r
.
owner
,
'op'
)
and
isinstance
(
r
.
owner
.
op
,
theano
.
scan_module
.
scan_op
.
Scan
):
if
(
hasattr
(
r
.
owner
,
'op'
)
and
isinstance
(
r
.
owner
.
op
,
theano
.
scan_module
.
scan_op
.
Scan
)):
scan_ops
.
append
(
r
)
scan_ops
.
append
(
r
)
debugmode
.
debugprint
(
r
,
depth
=
depth
,
done
=
done
,
print_type
=
print_type
,
debugmode
.
debugprint
(
r
,
depth
=
depth
,
done
=
done
,
print_type
=
print_type
,
...
@@ -122,7 +123,8 @@ def debugprint(obj, depth=-1, print_type=False,
...
@@ -122,7 +123,8 @@ def debugprint(obj, depth=-1, print_type=False,
for
s
in
scan_ops
:
for
s
in
scan_ops
:
print
>>
file
,
""
print
>>
file
,
""
debugmode
.
debugprint
(
s
,
depth
=
depth
,
done
=
done
,
print_type
=
print_type
,
debugmode
.
debugprint
(
s
,
depth
=
depth
,
done
=
done
,
print_type
=
print_type
,
file
=
_file
,
ids
=
ids
,
file
=
_file
,
ids
=
ids
,
scan_ops
=
scan_ops
,
stop_on_name
=
stop_on_name
)
scan_ops
=
scan_ops
,
stop_on_name
=
stop_on_name
)
if
hasattr
(
s
.
owner
.
op
,
'fn'
):
if
hasattr
(
s
.
owner
.
op
,
'fn'
):
...
@@ -135,10 +137,12 @@ def debugprint(obj, depth=-1, print_type=False,
...
@@ -135,10 +137,12 @@ def debugprint(obj, depth=-1, print_type=False,
if
isinstance
(
i
.
owner
.
op
,
theano
.
scan_module
.
scan_op
.
Scan
):
if
isinstance
(
i
.
owner
.
op
,
theano
.
scan_module
.
scan_op
.
Scan
):
scan_ops
.
append
(
i
)
scan_ops
.
append
(
i
)
debugmode
.
debugprint
(
r
=
i
,
prefix
=
new_prefix
,
depth
=
depth
,
done
=
done
,
debugmode
.
debugprint
(
r
=
i
,
prefix
=
new_prefix
,
depth
=
depth
,
done
=
done
,
print_type
=
print_type
,
file
=
file
,
print_type
=
print_type
,
file
=
file
,
ids
=
ids
,
stop_on_name
=
stop_on_name
,
ids
=
ids
,
stop_on_name
=
stop_on_name
,
prefix_child
=
new_prefix_child
,
scan_ops
=
scan_ops
)
prefix_child
=
new_prefix_child
,
scan_ops
=
scan_ops
)
if
file
is
_file
:
if
file
is
_file
:
return
file
return
file
...
@@ -696,8 +700,8 @@ def pydotprint(fct, outfile=None,
...
@@ -696,8 +700,8 @@ def pydotprint(fct, outfile=None,
varstr
=
(
input_update
[
var
]
.
variable
.
name
+
" UPDATE "
varstr
=
(
input_update
[
var
]
.
variable
.
name
+
" UPDATE "
+
str
(
var
.
type
))
+
str
(
var
.
type
))
else
:
else
:
#a var id is needed as otherwise var with the same type will be
#
a var id is needed as otherwise var with the same type will be
#merged in the graph.
#
merged in the graph.
varstr
=
str
(
var
.
type
)
varstr
=
str
(
var
.
type
)
if
(
varstr
in
all_strings
)
or
with_ids
:
if
(
varstr
in
all_strings
)
or
with_ids
:
idx
=
' id='
+
str
(
len
(
var_str
))
idx
=
' id='
+
str
(
len
(
var_str
))
...
@@ -726,7 +730,7 @@ def pydotprint(fct, outfile=None,
...
@@ -726,7 +730,7 @@ def pydotprint(fct, outfile=None,
prof_str
=
''
prof_str
=
''
if
mode
:
if
mode
:
time
=
mode
.
profile_stats
[
fct
]
.
apply_time
.
get
(
node
,
0
)
time
=
mode
.
profile_stats
[
fct
]
.
apply_time
.
get
(
node
,
0
)
#second, % total time in profiler, %fct time in profiler
#
second, % total time in profiler, %fct time in profiler
if
mode
.
local_time
==
0
:
if
mode
.
local_time
==
0
:
pt
=
0
pt
=
0
else
:
else
:
...
@@ -738,7 +742,7 @@ def pydotprint(fct, outfile=None,
...
@@ -738,7 +742,7 @@ def pydotprint(fct, outfile=None,
prof_str
=
' (
%.3
fs,
%.3
f
%%
,
%.3
f
%%
)'
%
(
time
,
pt
,
pf
)
prof_str
=
' (
%.3
fs,
%.3
f
%%
,
%.3
f
%%
)'
%
(
time
,
pt
,
pf
)
elif
profile
:
elif
profile
:
time
=
profile
.
apply_time
.
get
(
node
,
0
)
time
=
profile
.
apply_time
.
get
(
node
,
0
)
#second, %fct time in profiler
#
second, %fct time in profiler
if
profile
.
fct_callcount
==
0
:
if
profile
.
fct_callcount
==
0
:
pf
=
0
pf
=
0
else
:
else
:
...
@@ -819,7 +823,7 @@ def pydotprint(fct, outfile=None,
...
@@ -819,7 +823,7 @@ def pydotprint(fct, outfile=None,
elif
var
.
name
or
not
compact
:
elif
var
.
name
or
not
compact
:
g
.
add_edge
(
pd
.
Edge
(
varstr
,
astr
,
label
=
label
))
g
.
add_edge
(
pd
.
Edge
(
varstr
,
astr
,
label
=
label
))
else
:
else
:
#no name, so we don't make a var ellipse
#
no name, so we don't make a var ellipse
g
.
add_edge
(
pd
.
Edge
(
apply_name
(
var
.
owner
),
astr
,
label
=
label
))
g
.
add_edge
(
pd
.
Edge
(
apply_name
(
var
.
owner
),
astr
,
label
=
label
))
for
id
,
var
in
enumerate
(
node
.
outputs
):
for
id
,
var
in
enumerate
(
node
.
outputs
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论