designspace.destructure#
- designspace.destructure(config: dict[str, Any], param_path: str) tuple[str, dict[str, Any] | None]#
Both the variant name and its payload, in one call.
Equivalent to ds.variant() and ds.payload() together, and the natural way to unpack a choice.
- Parameters:
- Returns:
The variant name and its payload, the latter None when the variant carries no parameters.
- Return type:
Examples
>>> name, params = ds.destructure({"opt": {"sgd": {"momentum": 0.5}}}, "opt") >>> name, params ('sgd', {'momentum': 0.5}) >>> ds.destructure({"opt": "adagrad"}, "opt") ('adagrad', None)