ml_switcheroo.cli.matrix¶
Compatibility Matrix rendering logic.
This module is responsible for generating the visual comparison table between supported frameworks. It extracts operation mapping statuses from the SemanticsManager and presents them either as a formatted Rich table (CLI) or structured JSON data (Web Interface).
Refactor: Uses get_framework_priority_order() for fully dynamic sorting.
Classes¶
Logic for generating the Framework Compatibility Matrix. |
Module Contents¶
- class ml_switcheroo.cli.matrix.CompatibilityMatrix(semantics: ml_switcheroo.semantics.manager.SemanticsManager)¶
Logic for generating the Framework Compatibility Matrix.
It queries the Knowledge Base to determine which operations have defined variants for specific backends.
- semantics¶
- console¶
- get_json() List[Dict[str, str]]¶
Returns the compatibility matrix as structured data.
Useful for web interfaces or downstream tools that need to render the table dynamically (e.g. in React/Angular).
- Returns:
A list of row objects. Each dictionary contains:
’operation’: The abstract operation name.
’tier’: The semantic category.
’{engine}’: The status icon for that engine (e.g. ‘torch’: ‘✅’).
- Return type:
List[Dict[str, str]]
- render() None¶
Generates and prints the compatibility table to the console.
Uses the same underlying logic as get_json but formats it into a Rich Table with colored columns.