tf.contrib.autograph.to_graph

tf.contrib.autograph.to_graph(
    e,
    recursive=True,
    verbose=False,
    arg_values=None,
    arg_types=None,
    partial_types=None
)

Defined in tensorflow/contrib/autograph/impl/api.py.

Converts a Python entity into equivalent code that uses TensorFlow ops.

Supported Python entities include: * functions * classes

Classes are converted by converting all their methods into a new class.

Args:

  • e: Union[Callable, Type], the Python entity to convert.
  • recursive: bool, whether to recursively convert any functions that the converted function may call.
  • verbose: bool, whether to output the compiled code in the logs.
  • arg_values: Optional[Dict[Text, Any]], value hints for symbols including function arguments.
  • arg_types: Optional[Dict[Text, Type]], type hints for symbols including function arguments.
  • partial_types: Set[Type], reserved for internal use.

Returns:

Union[Callable, Type], the converted entity, which is the same kind as e (that is, a function is e is a function, a class if e is a class, etc.) but its code has been converted to use TF ops.

Raises:

  • ValueError: If the entity could not be converted.