TorchLean API

NN.IR.Check

IR Validation #

Validation helpers for NN.IR.Graph.

There are two validation levels:

Shape logic has one source of truth: Infer.inferNodeOutShape states the per-op shape rules, and Graph.checkShapes validates graph nodes through those rules.

Prop-level well-formedness wrappers #

The IR layer primarily exposes executable checkers (checkWellFormed, checkShapes) because that is what compilers/backends/exporters need: either accept a graph or produce a readable error.

For proofs it is often nicer to assume a proposition instead of carrying around Except String: WellFormed g means the checker succeeds, and similarly for WellShaped g.

These wrappers keep the executable checker names and proposition-level assumptions in the same module.

Core structural well-formedness (ids, arity, topo order), as a proposition.

Instances For

    Shape-consistency well-formedness (WellFormed + extra shape/axis checks), as a proposition.

    Instances For