# `Dala.Ml.Nx`
[🔗](https://github.com/manhvu/dala/blob/main/lib/dala/ml/nx.ex#L1)

Nx integration helpers for Dala.

Nx itself is pure Elixir and works on any platform. This module provides
backend selection logic and inference helpers.

# `axon_available?`

```elixir
@spec axon_available?() :: boolean()
```

Checks if Axon is available.

# `default_backend`

```elixir
@spec default_backend() :: module() | tuple()
```

Returns the default backend for the current platform.

# `emlx_available?`

```elixir
@spec emlx_available?() :: boolean()
```

Checks if EMLX is available.

# `inference`

```elixir
@spec inference(term(), term(), term()) :: {:ok, term()} | {:error, term()}
```

Runs inference with an Axon model using the best available backend.

# `init`

```elixir
@spec init() :: :emlx | :nx_binary
```

Initializes Nx with the best available backend for the current platform.

Priority:
1. EMLX (if available) - best for Apple Silicon
2. Nx.BinaryBackend (pure Elixir fallback)

# `tensor`

```elixir
@spec tensor(
  term(),
  keyword()
) :: Nx.Tensor.t()
```

Creates a tensor with the platform-appropriate backend.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
