Proof-Linked Session: Neural-Network Operations #
Record elementwise logistic sigmoid.
PyTorch comparison: torch.sigmoid(x).
Instances For
Record elementwise hyperbolic tangent.
PyTorch comparison: torch.tanh(x).
Instances For
Record softmax (shape-preserving).
PyTorch comparison: torch.softmax(x, dim=...). This helper uses the convention baked into the
underlying GraphM.softmax implementation.
Instances For
Record stable log-softmax in the linked compiled session.
This commits a single GraphM.logSoftmax node instead of expanding to softmax followed by
log, so compiled execution keeps the same stable semantics as eager CPU/CUDA.
Instances For
Record elementwise softplus.
PyTorch comparison: torch.nn.functional.softplus(x).
Instances For
Record elementwise exponential.
PyTorch comparison: torch.exp(x).
Instances For
Record elementwise natural logarithm.
PyTorch comparison: torch.log(x).
Instances For
Record elementwise log with epsilon guard.
This is intended for numerically stable losses; it corresponds approximately to log(max(x, ε)).
PyTorch comparison: torch.log(torch.clamp(x, min=ε)).
Instances For
Sum-reduce all elements to a scalar.
PyTorch comparison: x.sum().
Instances For
Record a fully-connected linear layer: y = w • x + b.
Type-level shapes enforce w : (outDim, inDim), b : (outDim,), and x : (inDim,).
PyTorch comparison: torch.nn.functional.linear(x, weight=w, bias=b) (with the same weight layout).
Instances For
Mean-squared-error loss returning a scalar.
PyTorch comparison: torch.nn.functional.mse_loss(yhat, target, reduction="mean").
Instances For
Layer normalization over the trailing embedding dimension.
This variant is specialized to 2D tensors of shape (seqLen, embedDim) and expects positive
dimensions for numerical stability and well-formedness.
PyTorch comparison: torch.nn.LayerNorm(embedDim) (applied per token), or
torch.nn.functional.layer_norm.
Instances For
Batch normalization for a channel-first image (C,H,W) (no batch axis).
gamma and beta are per-channel scale/shift parameters.
PyTorch comparison: torch.nn.BatchNorm2d(C) (conceptually), or torch.nn.functional.batch_norm
specialized to a single "batch element" with NCHW layout.