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)
| 729 | |
| 730 | @tf_export('autograph.to_code', v1=[]) |
| 731 | def 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) |
no test coverage detected