enzyme-autodiff
Installation
SKILL.md
Enzyme.jl Automatic Differentiation Skill
Enzyme.jl provides LLVM-level automatic differentiation for Julia, enabling high-performance gradient computation for both CPU and GPU code.
Type Annotations
Type annotations control how arguments are treated during differentiation:
| Annotation | Description | Usage |
|---|---|---|
Const(x) |
Constant, not differentiated | Parameters, hyperparameters |
Active(x) |
Scalar to differentiate (reverse mode only) | Scalar inputs |
Duplicated(x, ∂x) |
Mutable with shadow accumulator | Arrays, mutable structs |
DuplicatedNoNeed(x, ∂x) |
Like Duplicated, may skip primal | Performance optimization |
BatchDuplicated(x, ∂xs) |
Batched shadows (tuple) | Multiple derivatives at once |
MixedDuplicated(x, ∂x) |
Mixed active/duplicated data | Custom rules with mixed types |
using Enzyme