Skip to content

Commit dde3d4a

Browse files
committed
Correct map
1 parent a6f4cbd commit dde3d4a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

DifferentiationInterface/src/first_order/pullback.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function _pullback_via_pushforward(
168168
dy,
169169
contexts::Vararg{Context,C},
170170
) where {F,C}
171-
dx = map(CartesianIndices(x)) do j
171+
dx = map(CartesianIndices(x)) do xj, j
172172
t1 = pushforward(f, pushforward_prep, backend, x, (basis(x, j),), contexts...)
173173
convert(eltype(x), dot(only(t1), dy))
174174
end
@@ -254,7 +254,7 @@ function _pullback_via_pushforward(
254254
dy,
255255
contexts::Vararg{Context,C},
256256
) where {F,C}
257-
dx = map(CartesianIndices(x)) do j # preserve shape
257+
dx = map(CartesianIndices(x)) do xj, j # preserve shape
258258
t1 = pushforward(f!, y, pushforward_prep, backend, x, (basis(x, j),), contexts...)
259259
convert(eltype(x), dot(only(t1), dy))
260260
end

DifferentiationInterface/src/first_order/pushforward.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function _pushforward_via_pullback(
171171
dx,
172172
contexts::Vararg{Context,C},
173173
) where {F,C}
174-
dy = map(y, CartesianIndices(y)) do i
174+
dy = map(y, CartesianIndices(y)) do yi, i
175175
t1 = pullback(f, pullback_prep, backend, x, (basis(y, i),), contexts...)
176176
convert(eltype(y), dot(only(t1), dx))
177177
end
@@ -243,7 +243,7 @@ function _pushforward_via_pullback(
243243
dx,
244244
contexts::Vararg{Context,C},
245245
) where {F,C}
246-
dy = map(CartesianIndices(y)) do i # preserve shape
246+
dy = map(CartesianIndices(y)) do yi, i # preserve shape
247247
t1 = pullback(f!, y, pullback_prep, backend, x, (basis(y, i),), contexts...)
248248
convert(eltype(y), dot(only(t1), dx))
249249
end

0 commit comments

Comments
 (0)