elixir-nx/axon

Nx-powered Neural Networks

What it solves

Axon provides a comprehensive framework for building and training neural networks within the Elixir ecosystem. It allows developers to implement deep learning models without leaving their primary language, offering a high-level API for model creation and a structured API for managing training loops, while maintaining low-level control over numerical definitions.

How it works

Axon is built on top of Nx (numerical Elixir), and is structured into three primary layers:

  • Functional API: The foundation, consisting of defn (numerical definitions) for common deep learning components like activation functions, layers, and loss functions. This allows models to be JIT or AOT compiled for acceleration via Nx compilers.
  • Model Creation API: A high-level interface for defining models as Elixir structs. It separates the concerns of model definition from initialization and application, using Axon.build/2 to generate prediction and initialization functions.
  • Training API: A routine-based system inspired by PyTorch Ignite for implementing training loops, allowing users to instrument loops with metrics and event handlers.

Who it’s for

Elixir developers who want to integrate deep learning and neural network construction directly into their own applications, as well as those who need the flexibility to combine high-level model creation with low-level numerical acceleration.

Highlights

  • Nx-Powered: Fully integrates with Nx tensors and compilers (like EXLA) for hardware acceleration.
  • Decoupled APIs: The functional, model creation, and training APIs can be used independently.
  • Compilable: Supports JIT and AOT compilation, and as well as transformation into formats like TensorFlow Lite and ONNX.
  • Extensible: Allows users to compose Axon's functional API with their own custom numerical definitions.

Related

  • Project
  • Project
  • Project
  • Project
  • Project