Skip to content

Commit 864abfd

Browse files
committed
Fix
1 parent b32cba0 commit 864abfd

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

DifferentiationInterface/src/first_order/pullback.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ function _value_and_pullback_via_pushforward(
452452
dy,
453453
contexts::Vararg{Context, C},
454454
) where {F, C}
455-
a = last(value_and_pushforward(f!, y, pushforward_prep, backend, x, (oneunit(x),), contexts...))
455+
_, a = onlysecond(value_and_pushforward(f!, y, pushforward_prep, backend, x, (oneunit(x),), contexts...))
456456
dx = dot(a, dy)
457457
return dx
458458
end
@@ -467,7 +467,7 @@ function _value_and_pullback_via_pushforward(
467467
contexts::Vararg{Context, C},
468468
) where {F, C}
469469
a = only(pushforward(f!, y, pushforward_prep, backend, x, (oneunit(x),), contexts...))
470-
b = last(
470+
_, b = onlysecond(
471471
value_and_pushforward(f!, y, pushforward_prep, backend, x, (im * oneunit(x),), contexts...)
472472
)
473473
dx = real(dot(a, dy)) + im * real(dot(b, dy))
@@ -484,7 +484,7 @@ function _value_and_pullback_via_pushforward(
484484
contexts::Vararg{Context, C},
485485
) where {F, C}
486486
dx = map(CartesianIndices(x)) do j # preserve shape
487-
a = last(value_and_pushforward(f!, y, pushforward_prep, backend, x, (basis(x, j),), contexts...))
487+
_, a = onlysecond(value_and_pushforward(f!, y, pushforward_prep, backend, x, (basis(x, j),), contexts...))
488488
dot(a, dy)
489489
end
490490
return dx
@@ -501,7 +501,7 @@ function _value_and_pullback_via_pushforward(
501501
) where {F, C}
502502
dx = map(CartesianIndices(x)) do j # preserve shape
503503
a = only(pushforward(f!, y, pushforward_prep, backend, x, (basis(x, j),), contexts...))
504-
b = last(
504+
_, b = onlysecond(
505505
value_and_pushforward(
506506
f!, y, pushforward_prep, backend, x, (im * basis(x, j),), contexts...
507507
),

DifferentiationInterface/src/first_order/pushforward.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ function _value_and_pushforward_via_pullback(
453453
contexts::Vararg{Context, C},
454454
) where {F, C}
455455
dy = map(CartesianIndices(y)) do i # preserve shape
456-
a = last(value_and_pullback(f!, y, pullback_prep, backend, x, (basis(y, i),), contexts...))
456+
_, a = onlysecond(value_and_pullback(f!, y, pullback_prep, backend, x, (basis(y, i),), contexts...))
457457
dot(a, dx)
458458
end
459459
return dy
@@ -470,7 +470,7 @@ function _value_and_pushforward_via_pullback(
470470
) where {F, C}
471471
dy = map(CartesianIndices(y)) do i # preserve shape
472472
a = only(pullback(f!, y, pullback_prep, backend, x, (basis(y, i),), contexts...))
473-
b = last(
473+
_, b = onlysecond(
474474
value_and_pullback(f!, y, pullback_prep, backend, x, (im * basis(y, i),), contexts...)
475475
)
476476
real(dot(a, dx)) + im * real(dot(b, dx))

0 commit comments

Comments
 (0)