Model Summaries #
Structured model-summary rendering for checked sequential models.
Structured per-layer summary derived from a checked sequential model.
- index : ℕ
Zero-based position in the sequential layer list.
- kind : String
User-facing layer kind string.
- input : Shape
Checked input shape for this layer.
- output : Shape
Checked output shape for this layer.
Trainable parameter and persistent-buffer shapes owned by this layer.
- parameterCount : ℕ
Number of trainable scalar parameters in this layer.
- stateElementCount : ℕ
Number of scalar elements in this layer's complete state.
Instances For
One-line rendering of one layer summary.
Instances For
Structured whole-model summary derived from a checked sequential model.
- input : Shape
Checked input shape for the full model.
- output : Shape
Checked output shape for the full model.
- layers : Array LayerSummary
Per-layer summaries in order.
- layerCount : ℕ
Total number of layers in the sequential model.
- totalParameterCount : ℕ
Total scalar parameter count across all layers.
- totalStateElementCount : ℕ
Total scalar element count across trainable parameters and persistent buffers.
Instances For
Header line for the model summary.
Instances For
Multi-line rendering of the structured model summary.
Instances For
Validate a sequential model and construct its structured summary.
Instances For
Print the structured summary of a checked sequential model.
Example:
def model : nn.Sequential [2] [1] :=
nn.build 0 nn.Sequential![nn.linear 2 8, nn.relu, nn.linear 8 1]
-- Prints one row per layer with its kind, shapes, and parameter count, then the totals. The
-- counterpart of `print(model)` plus `torchinfo.summary`.
def main : IO Unit := nn.printSummary model