ml_switcheroo.frameworks.torch

PyTorch Adapter with Dynamic Introspection.

Attributes

torch

Classes

TorchAdapter

Adapter for PyTorch.

Module Contents

ml_switcheroo.frameworks.torch.torch = None
class ml_switcheroo.frameworks.torch.TorchAdapter

Adapter for PyTorch.

display_name: str = 'PyTorch'
inherits_from: None = None
ui_priority: int = 0
property search_modules: List[str]
property import_alias: Tuple[str, str]
property supported_tiers: List[ml_switcheroo.enums.SemanticTier]
property import_namespaces: Dict[str, Dict[str, str]]

Defines how to import specific submodules.

Example

“torch.nn” -> import torch.nn as nn (root=’torch’, sub=’nn’, alias=’nn’) “torch.nn.functional” -> import torch.nn.functional as F (root=’torch.nn.functional’, sub=None, alias=’F’)

property discovery_heuristics: Dict[str, List[str]]
property test_config: Dict[str, str]

Test templates for Torch.

property structural_traits: ml_switcheroo.frameworks.base.StructuralTraits
property definitions: Dict[str, ml_switcheroo.frameworks.base.StandardMap]

Comprehensive distributed definitions for PyTorch mappings. Moved from standards_internal.py.

property rng_seed_methods: List[str]
collect_api(category: ml_switcheroo.frameworks.base.StandardCategory) List[ml_switcheroo.frameworks.base.GhostRef]

Collects API signatures dynamically.

get_device_syntax(device_type: str, device_index: None | str = None) str
get_serialization_imports() List[str]
get_serialization_syntax(op: str, file_arg: str, object_arg: None | str = None) str
classmethod get_example_code() str
get_tiered_examples() Dict[str, str]
convert(data)
apply_wiring(snapshot: Dict[str, Any]) None

Applies manual fixes.