Skip to content

Commit 695dd77

Browse files
authored
Minor tidy: use peel rather than [1] and drop (#483)
1 parent 70f73c5 commit 695dd77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rule_definition_tools.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ function propagation_expr(Δs, ∂s, _conj=false, proj=identity)
294294

295295
# Apply `muladd` iteratively.
296296
# Explicit multiplication is only performed for the first pair of partial and gradient.
297-
init_expr = :(*($(_∂s[1]), $(Δs[1])))
298-
_∂s_Δs_tail = Iterators.drop(zip(_∂s, Δs), 1)
297+
(∂s_1, Δs_1), _∂s_Δs_tail = Iterators.peel(zip(_∂s, Δs))
298+
init_expr = :($∂s_1 * $Δs_1)
299299
summed_∂_mul_Δs = foldl(_∂s_Δs_tail; init=init_expr) do ex, (∂s_i, Δs_i)
300300
:(muladd($∂s_i, $Δs_i, $ex))
301301
end

0 commit comments

Comments
 (0)