function

pipeline.diff.validate_soft_tree

def validate_soft_tree(root: object, states: dict[str, State], lifecycle: object) -> None

Raise if the differentiable tree still contains a hard component.

Run after :func:`walk_swap` / :func:`walk_swap_states` to catch user-defined containers the structural recursion missed, or hard Assignment subclasses tucked behind a non-default Associate. The check keeps differentiable training honest: a caller seeing a NaN loss can rule out a silently-retained hard node.

Parameters

NameTypeDescription
rootobjectStage-tree root after the swap.
statesdict[str, State]State mapping after the swap.
lifecycleobjectLifecycle node after the swap.

Raises

  • TypeError — If any forbidden hard node survives.

Source: unitrack/pipeline/diff.py:273