Nx integration helpers for Dala.
Nx itself is pure Elixir and works on any platform. This module provides backend selection logic and inference helpers.
Summary
Functions
Checks if Axon is available.
Returns the default backend for the current platform.
Checks if EMLX is available.
Runs inference with an Axon model using the best available backend.
Initializes Nx with the best available backend for the current platform.
Creates a tensor with the platform-appropriate backend.
Functions
@spec axon_available?() :: boolean()
Checks if Axon is available.
Returns the default backend for the current platform.
@spec emlx_available?() :: boolean()
Checks if EMLX is available.
Runs inference with an Axon model using the best available backend.
@spec init() :: :emlx | :nx_binary
Initializes Nx with the best available backend for the current platform.
Priority:
- EMLX (if available) - best for Apple Silicon
- Nx.BinaryBackend (pure Elixir fallback)
@spec tensor( term(), keyword() ) :: Nx.Tensor.t()
Creates a tensor with the platform-appropriate backend.