TorchLean

4. Semantics and Graphs🔗

This section explains the objects that TorchLean claims are about.

The spec layer gives mathematical meanings to tensors, layers, losses, masks, modes, and scalar choices. GraphSpec gives a typed architecture language for models whose parameter layout and sharing structure should be explicit. NN.IR.Graph gives the operation-tagged graph consumed by widgets, exporters, runtime bridges, and verification passes.

These layers are connected, but they are not interchangeable. A spec definition is a mathematical reference. A GraphSpec model is an architecture with a typed parameter interface. An IR graph is a low-level artifact with op tags, parent ids, shapes, and payloads. Keeping those roles separate is what lets TorchLean say exactly what a runtime, compiler, or verifier has checked.

  1. 4.1. Graphs and IR
  2. 4.2. The Spec Layer
  3. 4.3. GraphSpec