tf.contrib.autograph.improved_errors

tf.contrib.autograph.improved_errors(
    *args,
    **kwds
)

Context manager that rewrites runtime errors.

This context manager will rewrite runtime errors so that their traceback is relative to the original code before conversion.

Use with the output of to_graph, and wrap the execution of respective ops. Example:

converted_my_func = ag.to_graph(my_func) ops = converted_my_func(...)

with ag.improved_errors(converted_my_func): sess.run(ops)

Args:

  • converted_function: Callable[..., Any], the output of a to_graph call

Yields:

None

Raises:

  • TfRuntimeError: if any OpError originates in the converted code, it will be wrapped into a TfRuntimeError
  • ValueError: If converted_function is not generated by AutoGraph