ml_switcheroo.frameworks.loader¶
Framework Definition Loader.
This module provides utilities to load static operation definitions from JSON files located in src/ml_switcheroo/frameworks/definitions/. It utilizes caching to ensure efficient access during runtime and discovery.
Attributes¶
Functions¶
|
Loads static definitions for a specific framework from its JSON file. |
|
Clears the LRU cache for definitions. |
|
Returns the resolved path for a framework's definition JSON. |
Module Contents¶
- ml_switcheroo.frameworks.loader.DEFINITIONS_DIR¶
- ml_switcheroo.frameworks.loader.load_definitions(framework: str) Dict[str, ml_switcheroo.frameworks.base.StandardMap][source]¶
Loads static definitions for a specific framework from its JSON file.
Uses functools.lru_cache to ensure the file is read and parsed only once per execution. Converts raw JSON dictionaries into StandardMap Pydantic objects.
- Parameters:
framework (str) – The framework key (e.g., ‘torch’, ‘jax’).
- Returns:
A dictionary mapping Operation Names to StandardDefs. Returns an empty dict if the definition file does not exist.
- Return type:
Dict[str, StandardMap]