File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11name = " ChainRulesCore"
22uuid = " d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
3- version = " 1.12"
3+ version = " 1.12.1 "
44
55[deps ]
66Compat = " 34da2185-b29b-5c13-b0c7-acf172513d20"
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ ProjectTo(::Any) = identity
122122
123123# Thunks
124124(project:: ProjectTo )(dx:: Thunk ) = Thunk (project ∘ dx. f)
125+ (project:: ProjectTo )(dx:: InplaceableThunk ) = project (dx. val)
125126
126127# Zero
127128ProjectTo (:: AbstractZero ) = ProjectTo {NoTangent} () # Any x::Zero in forward pass makes this one projector,
Original file line number Diff line number Diff line change @@ -427,6 +427,13 @@ struct NoSuperType end
427427 @test unthunk (pth) === 6.0 + 0.0im
428428 end
429429
430+ @testset " InplaceableThunk" begin
431+ it = InplaceableThunk (x -> x + 6 , @thunk 1 + 2 + 3 )
432+ pt = ProjectTo (4 + 5im )(it)
433+ @test pt isa Thunk
434+ @test unthunk (pt) === 6.0 + 0.0im
435+ end
436+
430437 @testset " Tangent" begin
431438 x = 1 : 3.0
432439 dx = Tangent {typeof(x)} (; step= 0.1 , ref= NoTangent ())
You can’t perform that action at this time.
0 commit comments