Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a763418b
提交
a763418b
authored
11月 06, 2015
作者:
Francesco Visin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reuse theano.gof.op.get_test_value() and fix cuda variables
上级
be939078
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
42 行增加
和
22 行删除
+42
-22
config.txt
doc/library/config.txt
+7
-0
configdefaults.py
theano/configdefaults.py
+1
-1
graph.py
theano/gof/graph.py
+27
-21
var.py
theano/sandbox/cuda/var.py
+7
-0
没有找到文件。
doc/library/config.txt
浏览文件 @
a763418b
...
...
@@ -861,6 +861,13 @@ import theano and print the config variable, as in:
optimization phase. Theano user's do not need to use this. This is
to help debug shape error in Theano optimization.
.. attribute:: print_test_value
Bool value, default: False
If ``'True'``, Theano will override the '__str__' method of its variables
to also print the tag.test_value when this is available.
.. attribute:: reoptimize_unpickled_function
Bool value, default: False (changed in master after Theano 0.7 release)
...
...
theano/configdefaults.py
浏览文件 @
a763418b
...
...
@@ -645,7 +645,7 @@ AddConfigVar(
AddConfigVar
(
'print_test_value
_by_default
'
,
'print_test_value'
,
(
"If 'True', Theano will override the '__str__' method of its "
"variables to also print the tag.test_value when this is available."
),
BoolParam
(
False
),
...
...
theano/gof/graph.py
浏览文件 @
a763418b
...
...
@@ -391,38 +391,44 @@ class Variable(Node):
self
.
name
=
name
self
.
auto_name
=
'auto_'
+
str
(
next
(
self
.
__count__
))
def
__str__
(
self
):
"""
WRITEME
def
__str__
(
self
,
firstPass
=
True
):
"""Return a str representation of the Variable
Return a printable name or description of the Variable. If
config.print_test_value is True it will also print the test_value if
any.
"""
if
config
.
print_test_value_by_default
:
if
self
.
__get_test_value__
()
is
not
None
:
return
'
\n
'
.
join
([
self
.
__str_name__
(),
self
.
__get_test_value__
()])
return
self
.
__str_name__
()
def
__str_name__
(
self
):
"""
WRITEME
to_print
=
[]
if
config
.
print_test_value
and
firstPass
:
try
:
to_print
.
append
(
self
.
__str_test_value__
())
except
AttributeError
:
return
self
.
__str__
(
False
)
"""
if
self
.
name
is
not
None
:
return
self
.
name
return
'
\n
'
.
join
([
self
.
name
]
+
to_print
)
if
self
.
owner
is
not
None
:
op
=
self
.
owner
.
op
if
self
.
index
==
op
.
default_output
:
return
str
(
self
.
owner
.
op
)
+
".out"
return
'
\n
'
.
join
(
[
str
(
self
.
owner
.
op
)
+
".out"
]
+
to_print
)
else
:
return
str
(
self
.
owner
.
op
)
+
"."
+
str
(
self
.
index
)
return
'
\n
'
.
join
(
[
str
(
self
.
owner
.
op
)
+
"."
+
str
(
self
.
index
)]
+
to_print
)
else
:
return
"<
%
s>"
%
str
(
self
.
type
)
return
'
\n
'
.
join
([
"<
%
s>"
%
str
(
self
.
type
)]
+
to_print
)
def
__str_test_value__
(
self
):
"""Return a repr of the test value
def
__get_test_value__
(
self
):
Return a printable representation of the test value. It can be
overridden by classes with non printable test_value to provide a
suitable representation of the test_value.
"""
try
:
return
repr
(
self
.
tag
.
test_value
)
except
AttributeError
:
r
eturn
Non
e
return
repr
(
theano
.
gof
.
op
.
get_test_value
(
self
)
)
except
:
r
ais
e
def
__repr__
(
self
):
return
str
(
self
)
...
...
theano/sandbox/cuda/var.py
浏览文件 @
a763418b
...
...
@@ -43,6 +43,13 @@ class _operators(tensor.basic._tensor_py_operators):
class
CudaNdarrayVariable
(
_operators
,
Variable
):
pass
# override default
def
__str_test_value__
(
self
):
try
:
return
repr
(
numpy
.
array
(
theano
.
gof
.
op
.
get_test_value
(
self
)))
except
:
raise
CudaNdarrayType
.
Variable
=
CudaNdarrayVariable
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论