ml_switcheroo.core.latex¶
LaTeX DSL Core Package.
This package contains the semantic primitives for the Machine Intelligence Definition Language (MIDL). It defines the node structures mirroring the LaTeX macros (Attribute, Op, etc.) used to visualize neural network architectures.
Submodules¶
Classes¶
Abstract base class for all MIDL nodes. |
|
Root container representing the Model definition block. |
|
Represents stateful memory allocation (e.g., Weights/Layers). |
|
Represents the model input definition. |
|
Represents a stateless operation call. |
|
Represents a call to a stateful layer defined in Memory. |
|
Represents the output return statement. |
Package Contents¶
- class ml_switcheroo.core.latex.LatexNode[source]¶
Bases:
abc.ABCAbstract base class for all MIDL nodes.
Enforces a
to_latex()method for serialization support.
- class ml_switcheroo.core.latex.ModelContainer[source]¶
Bases:
LatexNodeRoot container representing the Model definition block. Maps to the
DefModelenvironment.- name: str¶
The model class name.
- class ml_switcheroo.core.latex.MemoryNode[source]¶
Bases:
LatexNodeRepresents stateful memory allocation (e.g., Weights/Layers). Maps to the
\Attributemacro.Example:
\Attribute{conv}{Conv2d}{in=1, out=32, k=3}
- node_id: str¶
The unique identifier for the attribute.
- op_type: str¶
The operation type (e.g., ‘Conv2d’).
- config: Dict[str, str]¶
Configuration parameters for the layer.
- class ml_switcheroo.core.latex.InputNode[source]¶
Bases:
LatexNodeRepresents the model input definition. Maps to the
\Inputmacro.Example:
\Input{x}{[B, 1, 28, 28]}
- name: str¶
Name of the input variable.
- shape: str¶
Shape descriptor string.
- class ml_switcheroo.core.latex.ComputeNode[source]¶
Bases:
LatexNodeRepresents a stateless operation call. Maps to the
\Opmacro.Example:
\Op{s2}{Flatten}{s1, start=1}{[B, 21632]}
- node_id: str¶
The unique identifier to assign the result to.
- op_type: str¶
The operation type (e.g., ‘Flatten’).
- args: List[str]¶
List of arguments passed to the operation.
- shape: str¶
Resulting shape descriptor.
- class ml_switcheroo.core.latex.StateOpNode[source]¶
Bases:
LatexNodeRepresents a call to a stateful layer defined in Memory. Maps to the
\StateOpmacro.Example:
\StateOp{s1}{conv}{x}{[B, 32, 26, 26]}
- node_id: str¶
The unique identifier to assign the result to.
- attribute_id: str¶
The ID of the attribute being called.
- args: List[str]¶
List of arguments passed to the call.
- shape: str¶
Resulting shape descriptor.