MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / to_code

Function to_code

tensorflow/python/autograph/impl/api.py:731–755  ·  view source on GitHub ↗

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 cla

(entity, recursive=True, experimental_optional_features=None)

Source from the content-addressed store, hash-verified

729
730@tf_export('autograph.to_code', v1=[])
731def to_code(entity, recursive=True, experimental_optional_features=None):
732 """Similar to `to_graph`, but returns Python source code as a string.
733
734 Also see: `tf.autograph.to_graph`.
735
736 `to_graph` returns the Python source code that can be used to generate a
737 TensorFlow graph that is functionally identical to the input Python code.
738
739 Args:
740 entity: Python callable or class to convert.
741 recursive: Whether to recursively convert any functions that the converted
742 function may call.
743 experimental_optional_features: `None`, a tuple of, or a single
744 `tf.autograph.experimental.Feature` value. Controls the use of optional
745 features in the conversion process.
746
747 Returns:
748 The converted code as string.
749 """
750 source = tf_inspect.getsource(
751 to_graph(
752 entity,
753 recursive=recursive,
754 experimental_optional_features=experimental_optional_features))
755 return textwrap.dedent(source)

Callers 1

to_code_v1Function · 0.85

Calls 1

to_graphFunction · 0.85

Tested by

no test coverage detected