ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

tf.compat.v2.autograph.to_code

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.

entity Python callable or class to convert.
recursive Whether to recursively convert any functions that the converted function may call.
experimental_optional_features None, a tuple of, or a single tf.autograph.experimental.Feature value. Controls the use of optional features in the conversion process.

The converted code as string.
{"cc_re__cc_re__cc_by_4_0": ["ew -->\n\n<p><table class=\"responsive fixed orange\">\n<colgroup><col width=\"214px\"><col></colgroup>\n<tr><th colspan=\"2\"><h2 class=\"add-link\" id=\"returns\" data-text=\"Returns\">Returns</h2></th></tr>\n<tr class=\"alt\">\n<td colspan=\"2\">\nThe converted code as string.\n</td>\n</tr></p>\n\n<p></table></p>\n\n    \n\n    \n  </div>\n\n  \n\n  \n    \n    \n      \n       \n    \n    \n  \n\n  \n  \n</article>\n\n\n<devsite-content-footer class=\"nocontent\">\n  <p>Except as otherwise noted, the content of this page is licensed under the <a href=\"https://creativecommons.org/licenses/by/4.0/\">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href=\"https://www.apache.org/licenses/LICENSE-2.0\">Apache 2.0 License</a>. For details, see the <a href=\"https://developers.google.cn/site-policies\">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p>\n  <p>Last updated 2020-10-01 UTC.</p>\n</devsite-content-footer>\n\n\n\n\n\n  \n<div class=\"devsite-content-data\">\n  <template class=\"devsite-thumb-rating-down-categ"]}