Voltar ao ranking

FluxML/Zygote.jl

Juliafluxml.ai/Zygote.jl/

21st century AD

juliajulia-compilercontrol-flowgradientmachine-learningautomatic-differentiation
Crescimento de estrelas
Estrelas
1.6k
Forks
220
Crescimento semanal
Issues
204
5001k1.5k
ago. de 2018mar. de 2021nov. de 2023jul. de 2026
README

CI Testing Coverage Dev Docs

] add Zygote

Zygote provides source-to-source automatic differentiation (AD) in Julia, and is the next-gen AD system for the Flux differentiable programming framework. For more details and benchmarks of Zygote's technique, see our paper. You may want to check out Flux for more interesting examples of Zygote usage; the documentation here focuses on internals and advanced AD usage.

Zygote supports Julia 1.10 onwards.

julia> using Zygote

julia> f(x) = 5x + 3

julia> f(10), f'(10)
(53, 5.0)

julia> @code_llvm f'(10)
define i64 @"julia_#625_38792"(i64) {
top:
  ret i64 5
}

"Source-to-source" means that Zygote hooks into Julia's compiler, and generates the backwards pass for you – as if you had written it by hand.

Zygote supports the flexibility and dynamism of the Julia language, including control flow, recursion, closures, structs, dictionaries, and more. Mutation and exception handling are currently not supported.

julia> fs = Dict("sin" => sin, "cos" => cos, "tan" => tan);

julia> gradient(x -> fs[readline()](x), 1)
sin
0.5403023058681398

Zygote benefits from using the ChainRules.jl ruleset. Custom gradients can be defined by extending the ChainRulesCore.jl's rrule:

julia> using ChainRulesCore

julia> add(a, b) = a + b

julia> function ChainRulesCore.rrule(::typeof(add), a, b)
           add_pb(dy) = (NoTangent(), dy, dy)
           return add(a, b), add_pb
       end

To support large machine learning models with many parameters, Zygote can differentiate whole models with respect to their (possibly nested) structure of parameters, by passing them explicitly as arguments.

julia> using Zygote

julia> model = (W = rand(2, 3), b = rand(2));

julia> predict(model, x) = model.W * x .+ model.b;

julia> g = gradient(m -> sum(predict(m, [1, 2, 3])), model)[1]
(W = [1.0 2.0 3.0; 1.0 2.0 3.0], b = [1.0, 1.0])

[!WARNING] Zygote also has a legacy implicit-parameters interface, in which the parameters of interest are collected in a Zygote.Params object and the gradients returned in a dictionary-like Grads object. This interface is deprecated and will be removed in a future release; use the explicit style shown above instead.

Repositórios relacionados
JuliaLang/julia

The Julia Programming Language

JuliaMIT Licensejulia-languagejulia
julialang.org
48.9k5.9k
nteract/papermill

📚 Parameterize, execute, and analyze notebooks

PythonPyPIBSD 3-Clause "New" or "Revised" Licensejupyternotebooks
papermill.readthedocs.io/en/latest/
6.5k459
JuliaPluto/Pluto.jl

🎈 Simple reactive notebooks for Julia

JavaScriptnpmMIT Licensejuliareactive
plutojl.org
5.4k346
fonsp/Pluto.jl

🎈 Simple reactive notebooks for Julia

JuliaMIT Licensejuliareactive
plutojl.org
5.1k293
astroautomata/PySR

High-Performance Symbolic Regression in Python and Julia

PythonPyPIApache License 2.0symbolic-regressionmachine-learning
ai.damtp.cam.ac.uk/pysr
3.6k339
SciML/DifferentialEquations.jl

Multi-language suite for high-performance solvers of differential equations and scientific machine learning (SciML) components. Ordinary differential equations (ODEs), stochastic differential equations (SDEs), delay differential equations (DDEs), differential-algebraic equations (DAEs), and more in Julia.

JuliaOtherdifferential-equationsdifferentialequations
docs.sciml.ai/DiffEqDocs/stable/
3.1k250
grame-cncm/faust

Functional programming language for signal processing and sound synthesis

C++Otherfaustdsp
faust.grame.fr
3.1k420
multiprocessio/datastation

App to easily query, script, and visualize data from every database, file, and API.

TypeScriptnpmOthersqlmysql
datastation.multiprocess.io
3k112
MakieOrg/Makie.jl

Interactive data visualizations and plotting in Julia

JuliaMIT Licensejuliaplotting
docs.makie.org/stable
2.8k393
szcf-weiya/ESL-CN

The Elements of Statistical Learning (ESL)的中文翻译、代码实现及其习题解答。

Jupyter NotebookGNU General Public License v3.0eslstatistical-learning
esl.hohoweiya.xyz
2.8k623
MilesCranmer/PySR

High-Performance Symbolic Regression in Python and Julia

PythonPyPIApache License 2.0symbolic-regressionmachine-learning
ai.damtp.cam.ac.uk/pysr
2.7k232
jump-dev/JuMP.jl

Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)

JuliaOtheroptimizationjulia
jump.dev/JuMP.jl/
2.5k421