ml_switcheroo.testing.fuzzer.strategies¶
Hypothesis Strategies for ODL Types.
This module maps Operation Definition Language (ODL) type strings (e.g., Array['N'],
List[int]) into executable Hypothesis search strategies. It handles:
Primitives: Constraints-aware generation for ints, floats, bools.
Tensors: Numpy array generation with specific dtypes, ranks, and symbolic shapes.
Containers: Recursive generation of Lists, Tuples, and Dictionaries.
Symbolic Consistency: Ensuring named dimensions (e.g., ‘N’) resolve consistently across different arguments using a shared context.
Functions¶
|
Constructs a Hypothesis strategy from a type string and constraints. |
Module Contents¶
- ml_switcheroo.testing.fuzzer.strategies.strategies_from_spec(type_str: str, constraints: Dict[str, Any], shared_dims: Dict[str, Any] | None = None) hypothesis.strategies.SearchStrategy¶
Constructs a Hypothesis strategy from a type string and constraints.
Recursively parses complex types (e.g.,
List[int]) and delegates array creation to _array_strategy.- Parameters:
type_str – The ODL type hint (e.g. “int”, “Array[‘N’]”).
constraints – Dictionary of constraints (min, max, options).
shared_dims – Mutable dictionary mapping symbol names to shared integer strategies.
- Returns:
A valid Hypothesis SearchStrategy.