TorchLean API

NN.GraphSpec.Chain.Primitives

Standard sequential GraphSpec primitives #

This module provides dense linear, ReLU, and axis-wise softmax primitives together with their corresponding Chain constructors. Each primitive supplies pure tensor semantics, executable TorchLean lowering, and deterministic layer initialization.

def NN.GraphSpec.Primitive.linear (inDim outDim : ) :
Primitive [[outDim, inDim], [outDim]] [inDim] [outDim]

The affine map $x \mapsto Wx + b$ from vectors of length inDim to vectors of length outDim.

Its parameter ABI is [[outDim, inDim], [outDim]]. The corresponding TorchLean layer initializes the weight from the layer occurrence index and initializes the bias exactly to zero.

Instances For

    Parameter-free elementwise ReLU on tensors of shape s.

    Instances For

      Parameter-free softmax along axis. The axis bound is carried as an instance so ill-shaped softmax nodes cannot be constructed.

      Instances For
        def NN.GraphSpec.Chain.linear (inDim outDim : ) :
        Chain [[outDim, inDim], [outDim]] [inDim] [outDim]

        Chain constructor for Primitive.linear.

        Instances For

          Chain constructor for Primitive.relu.

          Instances For

            Chain constructor for Primitive.softmax.

            Instances For