combine (pmrf.combine)

pmrf.combine(*pytrees: Any) Any

Recombines previously partitioned PyTrees into a single, functional PyTree.

This function takes multiple sparse PyTrees (where missing elements are represented by None) and zips them back together into a complete structure.

This is a lower-level routine designed to be the exact inverse of pmrf.partition(). It is heavily utilized at the end of machine learning or optimization pipelines to inject newly generated or optimized parameter arrays back into their static physical context, reconstructing a valid, functional RF component. (Backed by Equinox).

Parameters:

*pytrees (Any) – Two or more partitioned PyTrees to merge. If a leaf is None in the first tree, it looks for the value in the second tree, and so forth.

Returns:

The fully recombined PyTree.

Return type:

Any

Examples

Reconstruct an RF model after sampling new parameters from a normalizing flow:

>>> new_arrays = flow.sample()
>>> new_model = pmrf.combine(new_arrays, static_physics)