提交 66d34ebe authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Fix misc. message formatting and grammar mistakes

上级 6700dcdf
...@@ -330,9 +330,9 @@ def raise_with_op( ...@@ -330,9 +330,9 @@ def raise_with_op(
else: else:
scalar_values.append("not shown") scalar_values.append("not shown")
else: else:
shapes = "The thunk don't have an inputs attributes." shapes = "The thunk doesn't have an `inputs` attributes."
strides = "So we can't access the strides of inputs values" strides = "So we can't access the strides of the input values"
scalar_values = "And can't print its inputs scalar value" scalar_values = "and we can't print its scalar input values"
clients = [[c[0] for c in fgraph.clients[var]] for var in node.outputs] clients = [[c[0] for c in fgraph.clients[var]] for var in node.outputs]
detailed_err_msg += ( detailed_err_msg += (
f"Inputs shapes: {shapes}" f"Inputs shapes: {shapes}"
...@@ -349,14 +349,15 @@ def raise_with_op( ...@@ -349,14 +349,15 @@ def raise_with_op(
detailed_err_msg += f"\nOutputs clients: {clients}\n" detailed_err_msg += f"\nOutputs clients: {clients}\n"
else: else:
hints.append( hints.append(
"HINT: Use another linker then the c linker to" "HINT: Use a linker other than the C linker to"
" have the inputs shapes and strides printed." " print the inputs' shapes and strides."
) )
# Print node backtraces # Print node backtraces
tr = getattr(node.outputs[0].tag, "trace", []) tr = getattr(node.outputs[0].tag, "trace", [])
if isinstance(tr, list) and len(tr) > 0: if isinstance(tr, list) and len(tr) > 0:
detailed_err_msg += "\nBacktrace when the node is created(use Aesara flag traceback__limit=N to make it longer):\n" detailed_err_msg += "\nBacktrace when the node is created "
detailed_err_msg += "(use Aesara flag traceback__limit=N to make it longer):\n"
# Print separate message for each element in the list of batcktraces # Print separate message for each element in the list of batcktraces
sio = io.StringIO() sio = io.StringIO()
...@@ -365,9 +366,9 @@ def raise_with_op( ...@@ -365,9 +366,9 @@ def raise_with_op(
detailed_err_msg += str(sio.getvalue()) detailed_err_msg += str(sio.getvalue())
else: else:
hints.append( hints.append(
"HINT: Re-running with most Aesara optimization disabled could" "HINT: Re-running with most Aesara optimizations disabled could"
" give you a back-trace of when this node was created. This can" " provide a back-trace showing when this node was created. This can"
" be done with by setting the Aesara flag" " be done by setting the Aesara flag"
" 'optimizer=fast_compile'. If that does not work," " 'optimizer=fast_compile'. If that does not work,"
" Aesara optimizations can be disabled with 'optimizer=None'." " Aesara optimizations can be disabled with 'optimizer=None'."
) )
...@@ -378,7 +379,7 @@ def raise_with_op( ...@@ -378,7 +379,7 @@ def raise_with_op(
f = io.StringIO() f = io.StringIO()
aesara.printing.debugprint(node, file=f, stop_on_name=True, print_type=True) aesara.printing.debugprint(node, file=f, stop_on_name=True, print_type=True)
detailed_err_msg += "\nDebugprint of the apply node: \n" detailed_err_msg += "\nDebug print of the apply node: \n"
detailed_err_msg += f.getvalue() detailed_err_msg += f.getvalue()
# Prints output_map # Prints output_map
...@@ -497,8 +498,8 @@ def raise_with_op( ...@@ -497,8 +498,8 @@ def raise_with_op(
else: else:
hints.append( hints.append(
"HINT: Use the Aesara flag 'exception_verbosity=high'" "HINT: Use the Aesara flag `exception_verbosity=high`"
" for a debugprint and storage map footprint of this apply node." " for a debug print-out and storage map footprint of this Apply node."
) )
try: try:
...@@ -506,7 +507,9 @@ def raise_with_op( ...@@ -506,7 +507,9 @@ def raise_with_op(
str(exc_value) + detailed_err_msg + "\n" + "\n".join(hints) str(exc_value) + detailed_err_msg + "\n" + "\n".join(hints)
) )
except TypeError: except TypeError:
warnings.warn(f"{exc_type} error does not allow us to add extra error message") warnings.warn(
f"{exc_type} error does not allow us to add an extra error message"
)
# Some exception need extra parameter in inputs. So forget the # Some exception need extra parameter in inputs. So forget the
# extra long error message in that case. # extra long error message in that case.
raise exc_value.with_traceback(exc_trace) raise exc_value.with_traceback(exc_trace)
...@@ -541,7 +544,7 @@ def __log_thunk_trace(value, handler: io.TextIOWrapper): ...@@ -541,7 +544,7 @@ def __log_thunk_trace(value, handler: io.TextIOWrapper):
write(line) write(line)
write( write(
"For the full definition stack trace set" "For the full definition stack trace set"
" the Aesara flags traceback__limit to -1" " the Aesara flags `traceback__limit` to -1"
) )
......
...@@ -409,7 +409,7 @@ second dimension ...@@ -409,7 +409,7 @@ second dimension
def get_output_info(self, dim_shuffle, *inputs): def get_output_info(self, dim_shuffle, *inputs):
"""Return the outputs dtype and broadcastable pattern and the """Return the outputs dtype and broadcastable pattern and the
dimshuffled niputs. dimshuffled inputs.
""" """
shadow = self.scalar_op.make_node( shadow = self.scalar_op.make_node(
...@@ -857,9 +857,9 @@ second dimension ...@@ -857,9 +857,9 @@ second dimension
return rval return rval
def _c_all(self, node, nodename, inames, onames, sub): def _c_all(self, node, nodename, inames, onames, sub):
# Some ops call directly the Elemwise._c_all or Elemwise.c_code # Some `Op`s directly call `Elemwise._c_all` or `Elemwise.c_code`
# To not request all of them to call prepare_node(), do it here. # To not request all of them to call prepare_node(), do it here.
# There is no harm if it get called multile time. # There is no harm if it get called multiple times.
if not hasattr(node.tag, "fake_node"): if not hasattr(node.tag, "fake_node"):
self.prepare_node(node, None, None, "c") self.prepare_node(node, None, None, "c")
_inames = inames _inames = inames
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论