ml_switcheroo.utils.doc_gen¶

Migration Guide Generator.

This module provides the logic to generate human-readable Markdown documentation comparing two frameworks (Source vs Target). It iterates through the Semantic Knowledge Base, calculating differences in API names and argument conventions (e.g., dim vs axis), and producing a structured migration guide.

Classes¶

MigrationGuideGenerator

Generates a Markdown Migration Guide by diffing semantic specifications.

Module Contents¶

class ml_switcheroo.utils.doc_gen.MigrationGuideGenerator(semantics: ml_switcheroo.semantics.manager.SemanticsManager)¶

Generates a Markdown Migration Guide by diffing semantic specifications.

semantics¶

The loaded knowledge base containing operations, variants, and argument maps.

Type:

SemanticsManager

semantics¶
generate(source_fw: str, target_fw: str) → str¶

Produces the Markdown content for the migration guide.

It groups operations by their Semantic Tier (Math, Neural, Extras), sorts them alphabetically, and generates a comparison table for each tier.

Parameters:
  • source_fw – The framework converting FROM (e.g., ‘torch’).

  • target_fw – The framework converting TO (e.g., ‘jax’).

Returns:

A string containing the rendered Markdown.