提交 ad06c45f authored 作者: Cesar Laurent's avatar Cesar Laurent

Added meaningful message when missing inputs to scan.

上级 acd4a90f
...@@ -836,14 +836,21 @@ def scan(fn, ...@@ -836,14 +836,21 @@ def scan(fn,
dummy_outs = outputs dummy_outs = outputs
if condition is not None: if condition is not None:
dummy_outs.append(condition) dummy_outs.append(condition)
dummy_f = function(dummy_args, # Perform a try-except to provide a meaningful error message to the
dummy_outs, # user if inputs of the inner function are missing.
updates=updates, try:
mode=compile.mode.Mode(linker='py', dummy_f = function(dummy_args,
optimizer=None), dummy_outs,
on_unused_input='ignore', updates=updates,
profile=False) mode=compile.mode.Mode(linker='py',
optimizer=None),
on_unused_input='ignore',
profile=False)
except gof.fg.MissingInputError as err:
msg = ("\nPlease pass this variable to the scan's inner function. Do "
"not forget to also pass it to the `non_sequences` attribute "
"of scan.")
raise gof.fg.MissingInputError(err.args[0] + msg)
## ##
# Step 5. Re-arange inputs of scan into a more strict order # Step 5. Re-arange inputs of scan into a more strict order
## ##
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论