TorchLean API

NN.API.Neural.Summary

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.

  • stateShapes : Array Shape

    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.

      • 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
              def TorchLean.nn.printSummary {σ τ : Shape} (model : Sequential σ τ) :

              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
              
              Instances For