`test_rrule`: also check output tangents with thunked fields
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- testing
Hướng nghiên cứu
Start with test_rrule and the existing check_thunked_output_tangent option, which currently calls the pullback with only the outer output tangent thunked. Reproduce the failure by wrapping each field of a Tangent output in a thunk and calling the pullback, as in the findnz example. Done means the new check runs for Tangent, Tuple and NamedTuple outputs, and that the unthunked and thunked results match. Decide with a maintainer whether to reuse the existing flag or add a new one.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
check_thunked_output_tangent=true only checks the pullback with the whole output tangent thunked, i.e. pullback(@thunk(ȳ)). But AD systems also pass structural tangents whose fields are thunks. For example, Zygote's tuple getindex adjoint keeps thunks, so for f(x)[i] the rule receives Tangent{Any}((ZeroTangent(), …, thunk, …)).
Rules that handle the outer thunk correctly can still fail on this. In JuliaDiff/ChainRules.jl#843, the findnz rule passed test_rrule, but with Zygote it failed:
using SparseArrays, Zygote
Zygote.gradient(A -> sum(findnz(A)[3]), sprand(5, 5, 0.4))
# MethodError: no method matching sparse(::Vector{Int64}, ::Vector{Int64}, ::InplaceableThunk{...}, ::Int64, ::Int64)
The pullback destructured _, _, V̄ = unthunk(Δ). Destructuring a Tangent does not unthunk its fields, unlike getindex/getproperty (see JuliaDiff/ChainRulesCore.jl#712).
Proposal: when the output tangent ȳ is a Tangent, or a Tuple/NamedTuple that is converted to one, test_rrule should additionally call the pullback with every field wrapped in a thunk, e.g. Tangent{P}(map(x -> @thunk(x), backing(ȳ))...), and compare the result with the unthunked cotangents. This could reuse the existing check_thunked_output_tangent flag or get a new one.
- Ngôn ngữ chính
- Julia
- Star
- 50
- Fork
- 18
- Merge trung bình
- 1 giờ 54 phút
- Pull request đã merge (30 ngày)
- 1
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của JuliaDiff/ChainRulesTestUtils.jl
-
code snippet in readmeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
JuliaDiff/ChainRulesTestUtils.jl#148 · 1 reaction ·
-
use DocThemeIndigoĐang mởdocumentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
more `test_approx` ambiguitiesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
-
mutation
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của JuliaDiff/ChainRulesTestUtils.jl
Issue tương tự
-
`SplitRungeKutta` time steppers never call `update_lagrangian_particle_state!`, so particle `tracked_fields` are never updatedCó thể đã có người làm @ali-ramadhan đã nhận hôm nay. Đang mởbug 🐞
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
CliMA/Oceananigans.jl#6381 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci system:windows test
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Single-column TKE example: boundary-layer depth description doesn't match Han & Bretherton (2019)Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
NumericalEarth/Breeze.jl#1143 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
format-check (Runic) is red on master: formatter drift on ~200 filesCó thể đã có người làm @ChrisRackauckas-Claude đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SciML/ModelingToolkit.jl#5337 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug parsers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
lanl-ansi/GasModels.jl#366 ·