{"id":19664842,"url":"https://github.com/fluxml/tracker.jl","last_synced_at":"2025-10-04T02:27:33.831Z","repository":{"id":34445158,"uuid":"174245966","full_name":"FluxML/Tracker.jl","owner":"FluxML","description":"Flux's ex AD","archived":false,"fork":false,"pushed_at":"2025-03-28T16:09:10.000Z","size":1640,"stargazers_count":54,"open_issues_count":37,"forks_count":36,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-09-06T04:53:56.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FluxML.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-07T01:07:18.000Z","updated_at":"2025-08-14T14:24:43.000Z","dependencies_parsed_at":"2023-02-16T11:15:35.445Z","dependency_job_id":"e598ea02-0ba2-480b-bc7d-40317ae3eaf3","html_url":"https://github.com/FluxML/Tracker.jl","commit_stats":{"total_commits":1724,"total_committers":102,"mean_commits":"16.901960784313726","dds":"0.31728538283062646","last_synced_commit":"91e52f932659ca0508d48fac849c96bfa53a2af3"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/FluxML/Tracker.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTracker.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTracker.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTracker.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTracker.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FluxML","download_url":"https://codeload.github.com/FluxML/Tracker.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluxML%2FTracker.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278254666,"owners_count":25956644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T16:19:15.598Z","updated_at":"2025-10-04T02:27:33.795Z","avatar_url":"https://github.com/FluxML.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tracker.jl\n\n[![Build Status](https://github.com/FluxML/Tracker.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/FluxML/Tracker.jl/actions/workflows/CI.yml?query=branch%3Amaster)\n[![Coverage](https://codecov.io/gh/FluxML/Tracker.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/FluxML/Tracker.jl)\n\u003c!---[![Coverage](https://coveralls.io/repos/github/FluxML/Tracker.jl/badge.svg?branch=master)](https://coveralls.io/github/FluxML/Tracker.jl?branch=master) ---\u003e\n[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)\n\n\nThis was the original automatic differentiation engine for [Flux.jl](https://github.com/FluxML/Flux.jl), before being replaced by [Zygote.jl](https://github.com/FluxML/Zygote.jl) in 2019. Both were written by Mike Innes.\n\nThis package is solid and still in active use, but is no longer heavily maintained. PRs and issues may go unanswered.\n\n### Introduction\n\nLike [ReverseDiff.jl](https://github.com/JuliaDiff/ReverseDiff.jl) and [AutoGrad.jl](https://github.com/denizyuret/AutoGrad.jl), Tracker traces through a program by wrapping arrays in a special `TrackedArray` type. The final answer contains a \"tape\" of the operations performed, which is reversed by `back!`:\n\n```julia\nx = param([1,2,3])  # Tracked 3-element Vector{Float64}\n\nf(x) = sum(abs2, x) + prod(x[2:end])\n\ny = f(x)  # TrackedReal\n\nback!(y)  # run back-propagation\n\nTracker.grad(x)  # extract gradient from TrackedArray\n```\n\nThis is a much lower-tech approach than that of [Zygote](https://github.com/FluxML/Zygote.jl), [Yota](https://github.com/dfdx/Yota.jl) and [Diffractor](https://github.com/JuliaDiff/Diffractor.jl). At best, those can produce fast, compiled Julia code for the reverse pass, instead of an interpreted tape. At worst, they can have extremely long compile-times and can be difficult to debug.\n\n### Interface\n\nInstead of calling `back!` yourself, you can pass the function and the input to `gradient`:\n\n```julia\ngradient(f, [1,2,3])  # returns ([2.0, 7.0, 8.0],)\n\nwithgradient(f, [1,2,3])  # returns (val = 20, grad = ([2.0, 7.0, 8.0],))\n```\n\nThe original interface to [Flux.jl](https://github.com/FluxML/Flux.jl) involved a dictionary of arrays called `Params`, much like Zygote's \"implicit\" parameter interface. This appears not to be documented.\n\nA more modern way to use Flux relies on `withgradient`'s ability to take gradients with respect to complex nested structures. This is what [Optimisers.jl](https://github.com/FluxML/Optimisers.jl) is designed to accept:\n\n```julia\njulia\u003e using Flux, Tracker\n\njulia\u003e model = Chain(Dense(2 =\u003e 1, tanh), Dense(1 =\u003e 1, bias=false));\n\njulia\u003e withgradient(model, rand(Float32, 2)) do m, x\n         sum(abs2, m(x))\n       end\n(val = 0.035716165f0, \n grad = ((layers = ((weight = Float32[-0.4241869 -0.16741231], bias = Float32[-0.5529184], σ = nothing), \n                    (weight = Float32[-0.04804218;;], bias = nothing, σ = nothing)),), \n         Float32[0.12706584, -0.08858479]))\n```\n\n### Rules\n\nTracker.jl contains rules for many common operations. It relies on [DiffRules.jl](https://github.com/JuliaDiff/DiffRules.jl) for many definitions, and does not connect to the newer [ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl) at all.\n\nTo define more rules, use `track` and `@grad`. See the source for more examples:\n\n```julia\nf(x::TrackedArray) = track(f, x)    # entry point, via dispatch\n\n@grad function f(x)\n  y = f(data(x))                    # forward pass, withtout tracking\n  back(dy) = (dy * ∂f∂x(data(x)),)  # pullback function, returns a tuple\n  return y, back\nend\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluxml%2Ftracker.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluxml%2Ftracker.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluxml%2Ftracker.jl/lists"}