designspace.variant#
- designspace.variant(config: dict[str, Any], param_path: str) str#
Which variant a choice parameter selected.
A choice value is either a bare name, when the variant has no parameters of its own, or a single-key dict when it does. This reads the name either way, so callers need not branch on the shape.
- Parameters:
- Returns:
The selected variant’s name.
- Return type:
Examples
>>> config = {"opt": {"sgd": {"momentum": 0.5}}} >>> ds.variant(config, "opt") 'sgd' >>> ds.variant({"opt": "adagrad"}, "opt") 'adagrad'