Skip to content

Commit 0860fe4

Browse files
committed
Warn on restructure length mismatch
1 parent 108cbc8 commit 0860fe4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,12 +610,15 @@ end
610610

611611
function _restructure(m, xs)
612612
i = 0
613-
fmap(m) do x
613+
= fmap(m) do x
614614
x isa AbstractArray || return x
615615
x = reshape(xs[i.+(1:length(x))], size(x))
616616
i += length(x)
617617
return x
618618
end
619+
620+
length(xs) == i || @warn "Expected $(i) params, got $(length(xs))"
621+
return
619622
end
620623

621624
@adjoint function _restructure(m, xs)

0 commit comments

Comments
 (0)