Session Neural-Network Operations #
This file contains higher-level neural-network session calls such as linear layers, normalization, attention, and convolutional blocks. The operations share the same session dispatch discipline as the elementary ops while preserving PyTorch-style call sites.
Fully-connected (affine) layer on vectors: $y=w\mathbin{\cdot}x+b$.
PyTorch analogue: torch.nn.functional.linear (weight shape (outDim, inDim)).
Instances For
Mean squared error loss returning a scalar.
PyTorch analogue: torch.nn.functional.mse_loss(..., reduction='mean').
Instances For
LayerNorm over a seqLen × embedDim tensor.
PyTorch analogue: torch.nn.LayerNorm(embedDim) applied per token.
Instances For
Batch normalization over every spatial axis of a channel-first tensor.
Instances For
N-D convolution over a channels-first tensor (inC, spatial...).
PyTorch analogue: torch.nn.functional.conv{d}d specialized to a single sample.
Instances For
N-D transpose convolution over a channels-first tensor (inC, spatial...).
PyTorch analogue: torch.nn.functional.conv_transpose{d}d specialized to a single sample.
Instances For
Multi-head self-attention (single sequence, single batch).
This is a convenience op used by the transformer examples; it corresponds approximately to the
forward pass of torch.nn.MultiheadAttention in "self-attention" mode.