提交 9d5290fc authored 作者: Ian Goodfellow's avatar Ian Goodfellow

added ability to use debug_assert without a message argument

上级 69aaa256
...@@ -313,7 +313,7 @@ class PureOp(object): ...@@ -313,7 +313,7 @@ class PureOp(object):
add_stack_trace_on_call = True add_stack_trace_on_call = True
"""This class variable governs whether __call__ adds a stack trace to the node it creates. """This class variable governs whether __call__ adds a stack trace to the node it creates.
The tag trace is meant to connect a node to the line a user typed. It is nice for The tag trace is meant to connect a node to the line a user typed. It is nice for
debugging. It does not make as much sense during optimizations to store this information. debugging. It does not make as much sense during optimizations to store this information.
""" """
...@@ -617,7 +617,9 @@ def debug_error_message(msg): ...@@ -617,7 +617,9 @@ def debug_error_message(msg):
warnings.warn(msg, stacklevel=2) warnings.warn(msg, stacklevel=2)
def debug_assert(condition, msg): def debug_assert(condition, msg = None):
if msg is None:
msg = 'debug_assert failed'
if not condition: if not condition:
action = config.compute_test_value action = config.compute_test_value
if action in ['raise', 'ignore']: if action in ['raise', 'ignore']:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论