提交 29e7c420 authored 作者: Frederic's avatar Frederic

pep8, typo, better display or err message(\n)

上级 66716e23
...@@ -584,13 +584,15 @@ class Function(object): ...@@ -584,13 +584,15 @@ class Function(object):
# done by raise_with_op is not implemented in C. # done by raise_with_op is not implemented in C.
if hasattr(self.fn, 'thunks'): if hasattr(self.fn, 'thunks'):
# For the CVM # For the CVM
gof.vm.raise_with_op(self.fn.nodes[self.fn.position_of_error], gof.vm.raise_with_op(
self.fn.thunks[self.fn.position_of_error]) self.fn.nodes[self.fn.position_of_error],
self.fn.thunks[self.fn.position_of_error])
else: else:
# For the c linker # For the c linker We don't have access from
# We don't have access from python to all the temps values # python to all the temps values So for now, we
# So for now, we just don't print the extra shapes/strides info # just don't print the extra shapes/strides info
gof.vm.raise_with_op(self.fn.nodes[self.fn.position_of_error]) gof.vm.raise_with_op(
self.fn.nodes[self.fn.position_of_error])
else: else:
# old-style linkers raise their own exceptions # old-style linkers raise their own exceptions
raise raise
......
...@@ -13,7 +13,7 @@ __excepthook = sys.excepthook ...@@ -13,7 +13,7 @@ __excepthook = sys.excepthook
def log_thunk_trace(value, f=sys.stderr): def log_thunk_trace(value, f=sys.stderr):
"""Log theano's diagnostic stack trace for an exception """Log Theano's diagnostic stack trace for an exception
raised by raise_with_op. raised by raise_with_op.
""" """
# in future, consider accepting `write` as arg rather than file # in future, consider accepting `write` as arg rather than file
...@@ -149,7 +149,7 @@ def raise_with_op(node, thunk=None, exc_info=None): ...@@ -149,7 +149,7 @@ def raise_with_op(node, thunk=None, exc_info=None):
sio = StringIO.StringIO() sio = StringIO.StringIO()
traceback.print_list(tr, sio) traceback.print_list(tr, sio)
tr = sio.getvalue() tr = sio.getvalue()
detailed_err_msg += "\nBacktrace when the node is created:" detailed_err_msg += "\nBacktrace when the node is created:\n"
detailed_err_msg += str(tr) detailed_err_msg += str(tr)
else: else:
hints.append( hints.append(
......
...@@ -19,17 +19,18 @@ import theano.gof.cmodule ...@@ -19,17 +19,18 @@ import theano.gof.cmodule
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
AddConfigVar('profile', AddConfigVar('profile',
"If VM should collect profile information", "If VM should collect profile information",
BoolParam(False), BoolParam(False),
in_c_key=False) in_c_key=False)
AddConfigVar('profile_optimizer', AddConfigVar('profile_optimizer',
"If VM should collect optimizer profile information", "If VM should collect optimizer profile information",
BoolParam(False), BoolParam(False),
in_c_key=False) in_c_key=False)
AddConfigVar('profile_memory', AddConfigVar('profile_memory',
"If VM should collect memory profile information and print it", "If VM should collect memory profile information and print it",
BoolParam(False), BoolParam(False),
in_c_key=False) in_c_key=False)
def filter_vm_lazy(val): def filter_vm_lazy(val):
if val == 'False' or val is False: if val == 'False' or val is False:
...@@ -40,7 +41,7 @@ def filter_vm_lazy(val): ...@@ -40,7 +41,7 @@ def filter_vm_lazy(val):
return None return None
else: else:
raise ValueError('Valid values for an vm.lazy parameter ' raise ValueError('Valid values for an vm.lazy parameter '
'should be None, False or True, not `%s`.' % val) 'should be None, False or True, not `%s`.' % val)
AddConfigVar('vm.lazy', AddConfigVar('vm.lazy',
"Useful only for the vm linkers. When lazy is None," "Useful only for the vm linkers. When lazy is None,"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论