This package includes an implementation of a flatten
function which flattens all data structures to vectors and returns an unflattenning function to back to the original data structure. This was originally part of NonconvexCore.jl.
JuliaNonconvex/DifferentiableFlatten.jl
Zygote-differentiable way of flattening and unflattening data structures
JuliaMIT