<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google/meridian/blob/v2.2.1/meridian/backend/config.py#L129-L168) |

Sets the backend for Meridian.

```python
meridian.backend.config.set_backend(
    backend: Union[`meridian.backend.config.Backend`, str]
) -> None
```

**Warning:** This function should ideally be called at the beginning of your
program, before any other Meridian modules are imported or used.

Changing the backend after Meridian's functions or classes have been
imported can lead to unpredictable behavior. This is because already-imported
modules will not reflect the backend change.

Changing the backend at runtime requires reloading the [`meridian.backend`](https://developers.google.com/meridian/reference/api/meridian/backend.md.txt)
module for the changes to take effect globally.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `backend` | The backend to use, must be a member of the `Backend` enum or a valid string ('tensorflow', 'jax'). |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If the provided backend is not valid. |

<br />