Sheaf is a functional language for machine learning. Inspired by Clojure, it compiles to StableHLO and runs on GPU via IREE.
Sheaf ships as a single native binary with zero runtime dependencies, for Linux (x86_64, aarch64) and macOS.
See the Quick Start guide for installation and first steps.
- Clojure paradigm: homoiconicity, immutability, minimalist syntax
- Native hardware performance: compiles to StableHLO, executes via IREE on CUDA, Metal GPU and CPU
- JIT compilation: pure functions are automatically compiled and dispatched to the best available device
- Reverse-mode autodiff: automatic differentiation on the expression graph, before compilation
(defn transformer-block [x layer-p config]
(as-> x h
(-> h
(layer-norm (get layer-p :ln1) 2)
(multi-head-attention layer-p config)
(first)
(+ h))
(-> h
(layer-norm (get layer-p :ln2) 2)
(mlp (get layer-p :mlp))
(+ h)))) ;; residual