Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cca20baf
提交
cca20baf
authored
12月 03, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3605 from fvisin/tag.test_value
Add print_test_value_by_default option
上级
146bca86
968de8cd
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
49 行增加
和
4 行删除
+49
-4
config.txt
doc/library/config.txt
+7
-0
configdefaults.py
theano/configdefaults.py
+10
-0
graph.py
theano/gof/graph.py
+25
-4
var.py
theano/sandbox/cuda/var.py
+4
-0
type.py
theano/sandbox/gpuarray/type.py
+3
-0
没有找到文件。
doc/library/config.txt
浏览文件 @
cca20baf
...
@@ -861,6 +861,13 @@ import theano and print the config variable, as in:
...
@@ -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
optimization phase. Theano user's do not need to use this. This is
to help debug shape error in Theano optimization.
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
.. attribute:: reoptimize_unpickled_function
Bool value, default: False (changed in master after Theano 0.7 release)
Bool value, default: False (changed in master after Theano 0.7 release)
...
...
theano/configdefaults.py
浏览文件 @
cca20baf
...
@@ -644,6 +644,16 @@ AddConfigVar(
...
@@ -644,6 +644,16 @@ AddConfigVar(
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'print_test_value'
,
(
"If 'True', the __eval__ of a Theano variable will return its test_value "
"when this is available. This has the practical conseguence that, e.g., "
"in debugging `my_var` will print the same as `my_var.tag.test_value` "
"when a test value is defined."
),
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'compute_test_value_opt'
,
AddConfigVar
(
'compute_test_value_opt'
,
(
"For debugging Theano optimization only."
(
"For debugging Theano optimization only."
" Same as compute_test_value, but is used"
" Same as compute_test_value, but is used"
...
...
theano/gof/graph.py
浏览文件 @
cca20baf
...
@@ -12,6 +12,7 @@ from copy import copy
...
@@ -12,6 +12,7 @@ from copy import copy
from
itertools
import
count
from
itertools
import
count
import
theano
import
theano
from
theano
import
config
from
theano.gof
import
utils
from
theano.gof
import
utils
from
six
import
string_types
,
integer_types
,
iteritems
from
six
import
string_types
,
integer_types
,
iteritems
from
theano.misc.ordered_set
import
OrderedSet
from
theano.misc.ordered_set
import
OrderedSet
...
@@ -391,8 +392,7 @@ class Variable(Node):
...
@@ -391,8 +392,7 @@ class Variable(Node):
self
.
auto_name
=
'auto_'
+
str
(
next
(
self
.
__count__
))
self
.
auto_name
=
'auto_'
+
str
(
next
(
self
.
__count__
))
def
__str__
(
self
):
def
__str__
(
self
):
"""
"""Return a str representation of the Variable.
WRITEME
"""
"""
if
self
.
name
is
not
None
:
if
self
.
name
is
not
None
:
...
@@ -406,8 +406,29 @@ class Variable(Node):
...
@@ -406,8 +406,29 @@ class Variable(Node):
else
:
else
:
return
"<
%
s>"
%
str
(
self
.
type
)
return
"<
%
s>"
%
str
(
self
.
type
)
def
__repr__
(
self
):
def
__repr_test_value__
(
self
):
return
str
(
self
)
"""Return a repr of the test value.
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.
"""
return
repr
(
theano
.
gof
.
op
.
get_test_value
(
self
))
def
__repr__
(
self
,
firstPass
=
True
):
"""Return a repr 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.
"""
to_print
=
[
str
(
self
)]
if
config
.
print_test_value
and
firstPass
:
try
:
to_print
.
append
(
self
.
__repr_test_value__
())
except
AttributeError
:
pass
return
'
\n
'
.
join
(
to_print
)
def
clone
(
self
):
def
clone
(
self
):
"""
"""
...
...
theano/sandbox/cuda/var.py
浏览文件 @
cca20baf
...
@@ -43,6 +43,10 @@ class _operators(tensor.basic._tensor_py_operators):
...
@@ -43,6 +43,10 @@ class _operators(tensor.basic._tensor_py_operators):
class
CudaNdarrayVariable
(
_operators
,
Variable
):
class
CudaNdarrayVariable
(
_operators
,
Variable
):
pass
pass
# override default
def
__repr_test_value__
(
self
):
return
repr
(
numpy
.
array
(
theano
.
gof
.
op
.
get_test_value
(
self
)))
CudaNdarrayType
.
Variable
=
CudaNdarrayVariable
CudaNdarrayType
.
Variable
=
CudaNdarrayVariable
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
cca20baf
...
@@ -420,6 +420,9 @@ class _operators(_tensor_py_operators):
...
@@ -420,6 +420,9 @@ class _operators(_tensor_py_operators):
class
GpuArrayVariable
(
_operators
,
Variable
):
class
GpuArrayVariable
(
_operators
,
Variable
):
# override the default
def
__repr_test_value__
(
self
):
return
repr
(
numpy
.
array
(
theano
.
gof
.
op
.
get_test_value
(
self
)))
pass
pass
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论