ml_switcheroo.testing.fuzzer ============================ .. py:module:: ml_switcheroo.testing.fuzzer .. autoapi-nested-parse:: Input Generation Engine for Semantics Verification. This module provides the `InputFuzzer`, responsible for creating randomized NumPy arrays, scalars, and complex container structures to feed into Framework A and Framework B during behavioral verification tests. Updates: - Support for `dtype` constraints in array generation (Limitation #2 Fix). Classes ------- .. autoapisummary:: ml_switcheroo.testing.fuzzer.InputFuzzer Module Contents --------------- .. py:class:: InputFuzzer(seed_shape: Optional[Tuple[int, Ellipsis]] = None) Generates dummy inputs (Arrays, Scalars, Containers) for equivalence testing. .. py:attribute:: MAX_RECURSION_DEPTH :value: 3 .. py:attribute:: max_depth :value: 3 .. py:method:: generate_inputs(params: List[str], hints: Optional[Dict[str, str]] = None, constraints: Optional[Dict[str, Dict]] = None) -> Dict[str, Any] Creates a dictionary of `{arg_name: value}`. Resolves symbolic dimensions across the entire parameter set. For example, if hints are `{'x': "Array['N']", 'y': "Array['N']"}`, both arrays will have matching lengths. :param params: List of argument names to generate (e.g. `['x', 'axis']`). :param hints: Dictionary of `{arg_name: type_string}` derived from Spec. :param constraints: Dictionary of `{arg_name: {min, max, options, dtype}}`. :returns: Randomized inputs ready for Framework adaptation. :rtype: Dict[str, Any] .. py:method:: adapt_to_framework(kwargs: Dict[str, Any], framework: str) -> Dict[str, Any] Converts Numpy inputs to framework-specific tensor types. Delegates to registered adapters (e.g., `TorchAdapter`, `JaxAdapter`). :param kwargs: Input dictionary with Numpy values. :param framework: Key of the framework (e.g., "torch", "jax"). :returns: Dict with framework-specific tensors.