提交 e9c47800 authored 作者: Frederic's avatar Frederic

Add Theano flag compute_test_value_opt.

上级 625955d8
...@@ -630,6 +630,12 @@ import theano and print the config variable, as in: ...@@ -630,6 +630,12 @@ import theano and print the config variable, as in:
this Op this Op
- ``'raise'`` will raise an Exception - ``'raise'`` will raise an Exception
.. attribute:: config.compute_test_value_opt
As ``compute_test_value``, but it is the value used during Theano
optimization phase. Theano user's do not need to use this. This is
to help debug shape error in Theano optimization.
.. attribute:: config.exception_verbosity .. attribute:: config.exception_verbosity
String Value: ``'low'``, ``'high'``. String Value: ``'low'``, ``'high'``.
......
...@@ -2118,7 +2118,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions ...@@ -2118,7 +2118,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
# optimize the fgraph # optimize the fgraph
compute_test_value_orig = theano.config.compute_test_value compute_test_value_orig = theano.config.compute_test_value
try: try:
theano.config.compute_test_value = "off" theano.config.compute_test_value = theano.config.compute_test_value_opt
optimizer(fgraph) optimizer(fgraph)
theano.compile.function_module.insert_deepcopy(fgraph, inputs, theano.compile.function_module.insert_deepcopy(fgraph, inputs,
......
...@@ -1018,7 +1018,7 @@ class FunctionMaker(object): ...@@ -1018,7 +1018,7 @@ class FunctionMaker(object):
compute_test_value_orig = theano.config.compute_test_value compute_test_value_orig = theano.config.compute_test_value
add_stack_trace_on_call = gof.Op.add_stack_trace_on_call add_stack_trace_on_call = gof.Op.add_stack_trace_on_call
try: try:
theano.config.compute_test_value = "off" theano.config.compute_test_value = theano.config.compute_test_value_opt
gof.Op.add_stack_trace_on_call = False gof.Op.add_stack_trace_on_call = False
start_optimizer = time.time() start_optimizer = time.time()
optimizer_profile = optimizer(fgraph) optimizer_profile = optimizer(fgraph)
......
...@@ -383,6 +383,13 @@ AddConfigVar('compute_test_value', ...@@ -383,6 +383,13 @@ AddConfigVar('compute_test_value',
in_c_key=False) in_c_key=False)
AddConfigVar('compute_test_value_opt',
("For debugging Theano optimization only."
" Same as compute_test_value, but is used"
" durint Theano optimizatoin"),
EnumStr('off', 'ignore', 'warn', 'raise'),
in_c_key=False)
"""Note to developers: """Note to developers:
Generally your exceptions should use an apply node's __str__ Generally your exceptions should use an apply node's __str__
method when exception_verbosity == 'low'. When exception_verbosity method when exception_verbosity == 'low'. When exception_verbosity
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论