<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/compiler/xla/xla.py#L62-L121) |

Builds an operator that compiles and runs `computation` with XLA. (deprecated)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.xla.experimental.compile`](https://www.tensorflow.org/api_docs/python/tf/xla/experimental/compile)

<br />

    tf.xla.experimental.compile(
        computation, inputs=None
    )

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: xla.experimental.compile is deprecated. Consider using [`@tf.function(jit_compile=True)`](https://www.tensorflow.org/api_docs/python/tf/function).

> [!NOTE]
> **Note:** In eager mode, `computation` will have [`@tf.function`](https://www.tensorflow.org/api_docs/python/tf/function) semantics.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `computation` | A Python function that builds a computation to apply to the input. If the function takes n inputs, 'inputs' should be a list of n `Tensor`s. <br /> `computation` may return a list of `Tensor`s and `Operation`s. `Tensor`s must come before `Operation`s in the returned list. All `Operation`s returned from `computation` will be executed when evaluating any of the returned output tensors. |
| `inputs` | A list of inputs or `None` (equivalent to an empty list). Each input can be a nested structure containing values that can be converted to `Tensor`s. Note that passing an N-dimension list of compatible values will result in an N-dimension list of scalar `Tensor`s rather than a single Rank-N `Tensor`. If you need a different behavior, convert parts of `inputs` to `Tensor`s with [`tf.convert_to_tensor`](https://www.tensorflow.org/api_docs/python/tf/convert_to_tensor). |

<br />

<br />

<br />

| ## Returns ||
|---|---|
| List of `Tensor`s corresponding to the `Tensor`s from the output of `computation` i.e. the same return value as if computation(\*inputs) is called directly, with the following exceptions: <br /> - None output: a NoOp would be returned with a control dependency on `computation`. - Single value output: a tuple containing the value would be returned. - Operation-only outputs: a NoOp would be returned with a control dependency on `computation`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `RuntimeError` | When eager execution is enabled. |

<br />

<br />

<br />

<br />

| ## Known issues ||
|---|---|
| When a tf.random operation is built with XLA, the implementation doesn't pass the user provided seed to the XLA compiler. As such, the XLA compiler generates a random number and uses it as a seed when compiling the operation. This implementation causes a violation of the Tensorflow defined semantics in two aspects. First, changing the value of the user defined seed doesn't change the numbers generated by the operation. Second, when a seed is not specified, running the program multiple times will generate the same numbers. ||

<br />