提交 2f673bcb authored 作者: Reyhane Askari's avatar Reyhane Askari

fix for docs and other minor fixes

上级 f54ad560
...@@ -255,6 +255,21 @@ import theano and print the config variable, as in: ...@@ -255,6 +255,21 @@ import theano and print the config variable, as in:
not predictable, so if you are close to the peak memory usage, trying both not predictable, so if you are close to the peak memory usage, trying both
could give you a small gain. could give you a small gain.
.. attribute:: check_stack_trace
String value, either ``off``, ``log``, ``warn``, ``raise``
Default: ``off``
This is a flag for checking the stack trace during the optimization process.
If :attr:`check_stack_trace` is set to ``off``, no check is performed on the
stack trace. If :attr:`check_stack_trace` is set to ``log`` or ``warn``, a
dummy stack trace is inserted that indicates which optimization inserted the
variable that had an empty stack trace but, in ``warn`` a warning is also
printed.
If :attr:`check_stack_trace` is set to ``raise``, an exception is raised if a
stack trace is missing.
.. attribute:: openmp .. attribute:: openmp
Bool value: either ``True`` or ``False`` Bool value: either ``True`` or ``False``
......
...@@ -227,13 +227,14 @@ optdb.register('merge3', gof.MergeOptimizer(), ...@@ -227,13 +227,14 @@ optdb.register('merge3', gof.MergeOptimizer(),
100, 'fast_run', 'merge') 100, 'fast_run', 'merge')
if theano.config.check_stack_trace in ['raise', 'warn', 'log']: if theano.config.check_stack_trace in ['raise', 'warn', 'log']:
tags = ('fast_run', 'fast_compile') _tags = ('fast_run', 'fast_compile')
if theano.config.check_stack_trace == 'off': if theano.config.check_stack_trace == 'off':
tags = () _tags = ()
optdb.register('CheckStackTrace', optdb.register('CheckStackTrace',
gof.CheckStackTraceOptimization(), -1, *tags) gof.CheckStackTraceOptimization(), -1, *_tags)
del _tags
class Mode(object): class Mode(object):
......
...@@ -1509,8 +1509,10 @@ AddConfigVar('check_stack_trace', ...@@ -1509,8 +1509,10 @@ AddConfigVar('check_stack_trace',
"A flag for checking the stack trace during the optimization process. " "A flag for checking the stack trace during the optimization process. "
"default (off): does not check the stack trace of any optimization " "default (off): does not check the stack trace of any optimization "
"log: inserts a dummy stack trace that identifies the optimization" "log: inserts a dummy stack trace that identifies the optimization"
"that inserted that variable." "that inserted the variable that had an empty stack trace."
"warn: prints a warning if a stack trace is missing" "warn: prints a warning if a stack trace is missing and also a dummy"
"stack trace is inserted that indicates which optimization inserted"
"the variable that had an empty stack trace."
"raise: raises an exception if a stack trace is missing", "raise: raises an exception if a stack trace is missing",
EnumStr('off', 'log', 'warn', 'raise'), EnumStr('off', 'log', 'warn', 'raise'),
in_c_key=False) in_c_key=False)
......
...@@ -3047,8 +3047,8 @@ class CheckStrackTraceFeature(object): ...@@ -3047,8 +3047,8 @@ class CheckStrackTraceFeature(object):
# theano.config.check_stack_trace is not off but we also double check here. # theano.config.check_stack_trace is not off but we also double check here.
if theano.config.check_stack_trace != 'off' and not check_stack_trace(fgraph, 'all'): if theano.config.check_stack_trace != 'off' and not check_stack_trace(fgraph, 'all'):
if theano.config.check_stack_trace == 'raise': if theano.config.check_stack_trace == 'raise':
raise NotImplementedError( raise AssertionError(
'Empty stack trace! The optimization that inserted this variable is' + str(reason)) 'Empty stack trace! The optimization that inserted this variable is ' + str(reason))
elif theano.config.check_stack_trace in ['log', 'warn']: elif theano.config.check_stack_trace in ['log', 'warn']:
apply_nodes_to_check = fgraph.apply_nodes apply_nodes_to_check = fgraph.apply_nodes
for node in apply_nodes_to_check: for node in apply_nodes_to_check:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论