RFC: Example Rule "Gallery" to showcase CRC best practices?

Aperta
#549 4 commenti 4 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Documentazione
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
julia
Ambito
documentation

Direzione di ricerca

La issue non indica file, test o un punto di ingresso concreto. Inizia esaminando gli esempi esistenti nella documentazione di ChainRules e l’ispirazione collegata per la galleria, quindi chiarisci l’ambito della galleria e il modello di contribuzione. Il lavoro sarà completo quando sarà stata concordata una struttura per presentare esempi personalizzati di rrule e frule e sarà stata presa una decisione su come selezionare gli esempi provenienti da package esterni.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

documentation

Following up on some Slack (#autodiff) discussion with @mzgubic, I want to float the idea of adding a CRC rule "gallery" to the ChainRules docs, inspired by analogous things in the plotting world (eg BeautifulMakie).

I think that best practices for rule authors have become a bit too complicated to sufficiently demonstrate with just one or two small examples per section in the docs, particularly with interplay between

  • custom structs & their constructors
  • higher order functions
  • CRC Thunks, Tangent types & AD callbacks

There are many clever rule authors in the wild who post helpful examples on Github/Discourse/Slack/Zulip but this information is very disaggregated and un-searchable. If there were some way for users to submit nice but less ultra-minimal examples and/or to aggregate relevant examples of custom rrule and frule definitions in published packages (as @ToucheSir suggested) I think linking to such a "gallery" from the CR docs would speed up the learning process for rule authors.

I would be glad to help realize such a thing if it seemed feasible and people wanted it.

Less organized thoughts from Slack:
A few custom rule examples I can find in forums but which I wouldn't know how to write based on CR docs:

  • Constructors of widely used AbstractArray subtypes like StaticArrays, StructArrays, etc.
  • LinearAlgebra methods of “implicit operator” types representing giant Matrices, eg from LinearMaps.jl
  • Iterative solver and partial decomposition methods involving the former, eg methods from IterativeSolvers.jl, KrylovKit.jl, Arpack.jl, etc, (“adjoint method” VJP rules)
  • Higher order function methods defined outside Base, often versions of map or reduce with parallelism.
  • Gradient accumulation into an InplaceableThunk of a custom struct
Lingua principale
Julia
Stelle
267
Fork
66
Merge medio
1g 1h
PR unite (30g)
9

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di JuliaDiff/ChainRulesCore.jl

Tutte le issue di JuliaDiff/ChainRulesCore.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.