Aliases:
tf.autograph.to_code
tf.contrib.autograph.to_code
tf.autograph.to_code(
entity,
recursive=True,
arg_values=None,
arg_types=None,
indentation=' ',
experimental_optional_features=tf.autograph.experimental.Feature.ALL,
experimental_partial_types=None
)
Defined in tensorflow/python/autograph/impl/api.py
.
Similar to to_graph
, but returns Python source code as a string.
Also see: tf.autograph.to_graph
.
to_graph
returns the Python source code that can be used to generate a
TensorFlow graph that is functionally identical to the input Python code.
Args:
entity
: Python callable or class to convert.recursive
: Whether to recursively convert any functions that the converted function may call.arg_values
: Optional dict of value hints for symbols including function arguments mapping string names to actual values. For example,arg_values={'a': 1}
will map the variablea
to the value1
.arg_types
: Optional dict of type hints for symbols including function arguments. Type hints allow specifying just the type of a variable, rather than a specific value.indentation
: The string to use for indenting. Typically two or four spaces, or just the tab character.experimental_optional_features
:None
, a tuple of, or a singletf.autograph.experimental.Feature
value. Controls the use of optional features in the conversion process.experimental_partial_types
: Aset
oftype
values, reserved for internal use.
Returns:
The converted code as string.