<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/auto_batching/instructions.py#L291-L350) |

A control flow graph (CFG).

#### View aliases


**Main aliases**

[`tfp.experimental.auto_batching.frontend.instructions.ControlFlowGraph`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/auto_batching/instructions/ControlFlowGraph), [`tfp.experimental.auto_batching.frontend.st.inst.ControlFlowGraph`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/auto_batching/instructions/ControlFlowGraph), [`tfp.experimental.auto_batching.frontend.stack.inst.ControlFlowGraph`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/auto_batching/instructions/ControlFlowGraph), [`tfp.experimental.auto_batching.stack_optimization.inst.ControlFlowGraph`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/auto_batching/instructions/ControlFlowGraph), [`tfp.experimental.auto_batching.stackless.inst.ControlFlowGraph`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/auto_batching/instructions/ControlFlowGraph)

<br />

    tfp.experimental.auto_batching.instructions.ControlFlowGraph(
        blocks
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `blocks` | Python list of `Block` objects, the content of the CFG. Any terminator instructions of said `Block` objects should refer to other `Block`s in the same CFG. Otherwise, downstream passes or staging may fail. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `blocks` | <br /> <br /> |

<br />

## Methods

### `block`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/auto_batching/instructions.py#L315-L324)

    block(
        index
    )

Returns the `Block` given by the input `index`.

<br />

<br />

<br />

| Args ||
|---|---|
| `index` | A Python `int`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `block` | The `Block` at that location in the block list. |

<br />

### `block_index`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/auto_batching/instructions.py#L326-L337)

    block_index(
        block
    )

Returns the `int` index of the given `Block`.

<br />

<br />

<br />

| Args ||
|---|---|
| `block` | The block to look up. If `None`, returns the exit index. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `index` | Python `int`, the index of the requested block. |

<br />

### `enter_block`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/auto_batching/instructions.py#L343-L345)

    enter_block()

Returns the entry `Block`.

### `exit_index`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/auto_batching/instructions.py#L339-L341)

    exit_index()

Returns the `int` index denoting "exit this CFG".