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

Đang mở
#549 4 bình luận 4 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
julia
Lĩnh vực
documentation

Hướng nghiên cứu

Issue không nêu tên tệp, test hay điểm bắt đầu cụ thể nào. Hãy bắt đầu bằng cách xem lại các ví dụ hiện có trong tài liệu ChainRules và nguồn cảm hứng cho gallery được liên kết, sau đó làm rõ phạm vi của gallery và mô hình đóng góp. Công việc được xem là hoàn tất khi đã thống nhất cấu trúc để giới thiệu các ví dụ rrule và frule tùy chỉnh, đồng thời đưa ra quyết định về cách lựa chọn các ví dụ từ các package bên ngoài.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Julia
Star
267
Fork
66
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của JuliaDiff/ChainRulesCore.jl

Tất cả issue của JuliaDiff/ChainRulesCore.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.