Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
492ea53c
提交
492ea53c
authored
8月 26, 2011
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added more design philosophy and an example output to the docstring for
min_informative_str
上级
789ed6a2
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
36 行增加
和
4 行删除
+36
-4
naming.py
theano/misc/naming.py
+36
-4
没有找到文件。
theano/misc/naming.py
浏览文件 @
492ea53c
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
class
_TagGenerator
:
class
_TagGenerator
:
""" Class for giving abbreviated tags like to objects.
""" Class for giving abbreviated tags like to objects.
Only really intended for internal use """
Only really intended for internal use in order to
implement min_informative_st """
def
__init__
(
self
):
def
__init__
(
self
):
self
.
cur_tag_number
=
0
self
.
cur_tag_number
=
0
...
@@ -33,14 +34,12 @@ class _TagGenerator:
...
@@ -33,14 +34,12 @@ class _TagGenerator:
return
rval
return
rval
def
min_informative_str
(
obj
,
indent_level
=
0
,
_prev_obs
=
None
,
_tag_generator
=
None
):
def
min_informative_str
(
obj
,
indent_level
=
0
,
_prev_obs
=
None
,
_tag_generator
=
None
):
"""
"""
Returns a string specifying to the user what obj is
Returns a string specifying to the user what obj is
The string will print out as much of the graph as is needed
The string will print out as much of the graph as is needed
for the whole thing to be specified in terms only of constants
for the whole thing to be specified in terms only of constants
or named variables
or named variables
.
Parameters
Parameters
...
@@ -51,6 +50,39 @@ def min_informative_str(obj, indent_level = 0, _prev_obs = None, _tag_generator
...
@@ -51,6 +50,39 @@ def min_informative_str(obj, indent_level = 0, _prev_obs = None, _tag_generator
_prev_obs: should only be used to by min_informative_str
_prev_obs: should only be used to by min_informative_str
a dictionary mapping previously converted
a dictionary mapping previously converted
objects to short tags
objects to short tags
Basic design philosophy
-----------------------
The idea behind this function is that it can be used as parts of command line tools
for debugging or for error messages. The information displayed is intended to be
concise and easily read by a human. In particular, it is intended to be informative
when working with large graphs composed of subgraphs from several different people's
code, as in pylearn2.
Stopping expanding subtrees when named variables are encountered makes it easier to
understand what is happening when a graph formed by composing several different graphs
made by code written by different authors has a bug.
An example output is:
A. Elemwise{add_no_inplace}
B. log_likelihood_v_given_h
C. log_likelihood_h
If the user is told they have a problem computing this value, it's obvious that either
log_likelihood_h or log_likelihood_v_given_h has the wrong dimensionality. The variable's
str object would only tell you that there was a problem with an Elemwise{add_no_inplace}.
Since there are many such ops in a typical graph, such an error message is considerably
less informative. Error messages based on this function should convey much more information
about the location in the graph of the error while remaining succint.
One final note: the use of capital letters to uniquely identify nodes within the graph
is motivated by legibility. I do not use numbers or lower case letters since these are
pretty common as parts of names of ops, etc. I also don't use the object's id like in
debugprint because it gives such a long string that takes time to visually diff.
"""
"""
if
_prev_obs
is
None
:
if
_prev_obs
is
None
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论