# tf.compat.v1.autograph.to_code

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/autograph/impl/api.py#L693-L727) |

Similar to `to_graph`, but returns Python source code as a string.

    tf.compat.v1.autograph.to_code(
        entity, recursive=True, arg_values=None, arg_types=None, indentation='  ',
        experimental_optional_features=None
    )

Also see: [`tf.autograph.to_graph`](https://www.tensorflow.org/versions/r2.0/api_docs/python/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.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `entity` | Python callable or class to convert. |
| `recursive` | Whether to recursively convert any functions that the converted function may call. |
| `arg_values` | Deprecated. |
| `arg_types` | Deprecated. |
| `indentation` | Deprecated. |
| `experimental_optional_features` | `None`, a tuple of, or a single [`tf.autograph.experimental.Feature`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/autograph/experimental/Feature) value. Controls the use of optional features in the conversion process. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The converted code as string. ||

<br />