ml_switcheroo.frameworksΒΆ

Framework Adapters Package.

Automatically discovers and registers framework adapters by scanning this directory for modules. This allows for β€œZero-Edit” extensibility: simply drop a new adapter file (e.g., tinygrad.py) into this folder, and it will be automatically registered.

This module exposes the registry helpers (get_adapter, available_frameworks) but relies on the side-effects of importing submodules to populate the internal _ADAPTER_REGISTRY.

SubmodulesΒΆ

ClassesΒΆ

FrameworkAdapter

Protocol definition for a Framework Adapter.

FunctionsΒΆ

register_framework(name)

get_adapter(β†’Β Optional[FrameworkAdapter])

available_frameworks(β†’Β List[str])

Package ContentsΒΆ

class ml_switcheroo.frameworks.FrameworkAdapter[source]ΒΆ

Bases: Protocol

Protocol definition for a Framework Adapter.

convert(data: Any) β†’ Any[source]ΒΆ
property test_config: Dict[str, str]ΒΆ
property harness_imports: List[str]ΒΆ
get_harness_init_code() β†’ str[source]ΒΆ
get_to_numpy_code() β†’ str[source]ΒΆ
property search_modules: List[str]ΒΆ
property display_name: strΒΆ
property ui_priority: intΒΆ
property discovery_heuristics: Dict[str, List[str]]ΒΆ
property supported_tiers: List[ml_switcheroo.enums.SemanticTier]ΒΆ
property import_alias: Tuple[str, str]ΒΆ
property inherits_from: str | NoneΒΆ
property structural_traits: ml_switcheroo.semantics.schema.StructuralTraitsΒΆ
property plugin_traits: ml_switcheroo.semantics.schema.PluginTraitsΒΆ
property rng_seed_methods: List[str]ΒΆ
property declared_magic_args: List[str]ΒΆ
property unsafe_submodules: Set[str]ΒΆ
get_device_syntax(device_type: str, device_index: str | None = None) β†’ str[source]ΒΆ
get_device_check_syntax() β†’ str[source]ΒΆ
get_rng_split_syntax(rng_var: str, key_var: str) β†’ str[source]ΒΆ
get_serialization_syntax(op: str, file_arg: str, object_arg: str | None = None) β†’ str[source]ΒΆ
get_serialization_imports() β†’ List[str][source]ΒΆ
get_weight_conversion_imports() β†’ List[str][source]ΒΆ
get_weight_load_code(path_var: str) β†’ str[source]ΒΆ
get_tensor_to_numpy_expr(tensor_var: str) β†’ str[source]ΒΆ
get_weight_save_code(state_var: str, path_var: str) β†’ str[source]ΒΆ
get_doc_url(api_name: str) β†’ str | None[source]ΒΆ
get_tiered_examples() β†’ Dict[str, str][source]ΒΆ
property definitions: Dict[str, StandardMap]ΒΆ
property specifications: Dict[str, ml_switcheroo.semantics.schema.OperationDef]ΒΆ
property import_namespaces: Dict[str, Dict[str, str] | ImportConfig]ΒΆ
collect_api(category: StandardCategory) β†’ List[ml_switcheroo.core.ghost.GhostRef][source]ΒΆ
apply_wiring(snapshot: Dict[str, Any]) β†’ None[source]ΒΆ
ml_switcheroo.frameworks.register_framework(name: str)[source]ΒΆ
ml_switcheroo.frameworks.get_adapter(name: str) β†’ FrameworkAdapter | None[source]ΒΆ
ml_switcheroo.frameworks.available_frameworks() β†’ List[str][source]ΒΆ