A functional language for differentiable programming
Project description
Sheaf is a functional language for differentiable computation. It is inspired by Clojure and is designed to operate within the Python/JAX machine learning ecosystem.
Sheaf has three main goals:
- Clojure Paradigm: Homoiconicity (code is data), immutability and minimalist syntax.
- Native XLA Performance: Sheaf code runs on GPUs/TPUs through JAX.
- Seamless Interop with Python: Compiled to pure JAX functions natively callable from Python.
Sample code:
(defn transformer-block [x layer-p config]
(as-> x h
(-> h ;; 1. Self-Attention
(layer-norm (get layer-p :ln1) 2)
(multi-head-attention layer-p config)
(first) ;; Attention output
(+ h)) ;; Residual 1
(-> h ;; 2. MLP
(layer-norm (get layer-p :ln2) 2)
(mlp (get layer-p :mlp))
(+ h)))) ;; Residual 2
Python interoperability
from sheaf import Sheaf
shf = Sheaf("mlp.shf")
for x, y in zip(X, shf.forward(X, params)):
print(f" {x} -> {y[0]:.3f}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sheaf_lang-1.2.0.tar.gz
(79.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sheaf_lang-1.2.0.tar.gz.
File metadata
- Download URL: sheaf_lang-1.2.0.tar.gz
- Upload date:
- Size: 79.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54bfd3b38314f874a5958d909d34e0c068e4bc04808b2cb2a3a6f5815b96ae29
|
|
| MD5 |
d8a8b42af91289c177c089be3f9e244e
|
|
| BLAKE2b-256 |
ff08d73cb62bc2e9156e8d906bb1d9596d81952b4733c8d5b3535ca66647b44b
|
File details
Details for the file sheaf_lang-1.2.0-py3-none-any.whl.
File metadata
- Download URL: sheaf_lang-1.2.0-py3-none-any.whl
- Upload date:
- Size: 82.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e7fbab6f2251bf420daff31882c94740efd63c7bbadfdf659afb2dfde537986
|
|
| MD5 |
67e3040adfd985f46f0849069726d06e
|
|
| BLAKE2b-256 |
e47d87719dc20b610c8708749c6c9708489553d1f989cfd3bb7449801aa35543
|