Utilities reference
evomo.utils exports 32 helpers in 4 modules — config (12), pf (2), state (3), tensor_ops (15) — split by what they act on rather than by caller.
The require_* validators, normalize_bounds, to_float_tuple, validate_config and register_config_pytree run in make_*, pf loads the packaged .pf data, and state replaces or inspects a workflow state tree.
bake_bounds and bake_float32_constant build graph constants, and the tensor_ops helpers are lowering-safe tensor functions (safe_divide, flip, cumsum_axis1, segment_reduce, ...) that evoxc either lacks or that the compiled backends cannot export directly.
Both groups are called inside init, step or evaluate, and outside a trace they raise TraceError; a helper evox already provides is not duplicated here.
config (12)
| Helper |
Module |
Contract |
bake_bounds |
utils/config.py |
Bake a (lb, ub) pair as float32 graph constants of equal shape. |
bake_float32_constant |
utils/config.py |
Bake host values as a float32 graph constant (call inside a trace). |
normalize_bounds |
utils/config.py |
Validate a (lb, ub) pair and normalize both bounds to float tuples. |
register_config_pytree |
utils/config.py |
Register a callable-bearing config class as a zero-child pytree node. |
require_between |
utils/config.py |
Require value inside [low, high] (inclusivity configurable). |
require_choice |
utils/config.py |
Require value in choices and return it. |
require_ge |
utils/config.py |
Require value >= bound and return it. |
require_gt |
utils/config.py |
Require value > bound and return it. |
require_int |
utils/config.py |
Require a plain int in [minimum, maximum] and return it. |
require_positive |
utils/config.py |
Require value > 0 and return it. |
to_float_tuple |
utils/config.py |
Normalize an array-like value to a flat tuple of plain Python floats. |
validate_config |
utils/config.py |
Validate that a config is a frozen dataclass of static pytree leaves. |
pf (2)
| Helper |
Module |
Contract |
available_pareto_fronts |
utils/pf.py |
List the reference fronts shipped with a package. |
load_pareto_front_from_file |
utils/pf.py |
Load one reference Pareto front from package data. |
state (3)
| Helper |
Module |
Contract |
check_state_shapes |
utils/state.py |
Validate that every tensor leaf has a fully static shape and a legal dtype. |
replace_state |
utils/state.py |
Return a copy of state with the given fields replaced. |
tree_shapes |
utils/state.py |
Report the static shape of every leaf of a state tree. |
tensor_ops (15)
| Helper |
Module |
Contract |
cummin_axis1 |
utils/tensor_ops.py |
Cumulative minimum along axis 1 of a 2-D tensor. |
cumprod_axis1 |
utils/tensor_ops.py |
Cumulative product along axis 1 of a 2-D tensor (cumprod is deferred). |
cumsum_axis1 |
utils/tensor_ops.py |
Cumulative sum along axis 1 of a 2-D tensor (cumsum is deferred). |
flip |
utils/tensor_ops.py |
Reverse a tensor along one axis (evoxc.flip is deferred on compiled backends). |
lexsort_columns |
utils/tensor_ops.py |
Lexicographic sort permutation of 1-D keys, keys[0] primary. |
masked_select_indices |
utils/tensor_ops.py |
Stably pack up to k true positions of a 1-D mask into fixed shape. |
minmax_normalize |
utils/tensor_ops.py |
Column-wise min-max normalization of an (n, m) tensor. |
pairwise_cosine_similarity |
utils/tensor_ops.py |
Cosine similarities between every pair of row vectors. |
pairwise_max_difference |
utils/tensor_ops.py |
Per-pair maximum coordinate difference max_d(x[i, d] - y[j, d]). |
safe_divide |
utils/tensor_ops.py |
Elementwise quotient with a sign-preserving floor on the denominator. |
safe_nan_to_num |
utils/tensor_ops.py |
Replace NaN/±inf entries (the nan_to_num replacement; that op is deferred). |
scatter_add_1d |
utils/tensor_ops.py |
Add values into target at indices (scatter_add is unavailable). |
segment_reduce |
utils/tensor_ops.py |
Reduce values per segment id using a static (n_segments, k) membership matrix. |
shifted_distance |
utils/tensor_ops.py |
Directed shift-based distances ||max(x[i], x[j]) - x[i]||_2. |
unique_rows_sorted |
utils/tensor_ops.py |
Lexicographically sort rows and mark the first occurrence of each row. |