Reference and Portable Backend Capsules #
Portable capsules for paths that do not require CUDA or LibTorch.
These are not meant to win benchmarks. They keep TorchLean runnable on CPU-only machines and give the planner a clear fallback vocabulary for reference/spec-aligned execution.
Build a checked portable CPU capsule with explicit value, VJP, shape, and layout contracts.
Instances For
Build the standard portable capsule for a pointwise operation.
Instances For
Build a portable reduction capsule with deterministic left-to-right accumulation.
Instances For
Reference kernel whose scalar result contains an explicit left-to-right accumulation.
Matrix products, affine layers, convolutions, and averaging operations all reduce several products or samples into one output entry. Keeping this constructor separate from pointwise kernels prevents the numerical audit from incorrectly reporting that reduction order is irrelevant.
Instances For
Build the standard portable capsule for a shape or layout transformation.
Instances For
Build a portable forward-only capsule with no registered reverse derivative.
Instances For
SiLU calls the canonical value and VJP directly, without an intermediate sigmoid tensor.
Instances For
Reference pointwise hyperbolic tangent.
Instances For
Reference pointwise natural logarithm.
Instances For
Reference quotient arithmetic with the recorded quotient-rule VJP.
Instances For
Reference scalar negation with the sign-reversing VJP.
Instances For
Reference smooth logarithm surrogate log (softplus x + epsilon).
Instances For
Reference log-softmax reduction and normalization.
Instances For
Reference hard-masked softmax with exact zero weight at blocked coordinates.
Instances For
Reference arithmetic-mean reduction.
Instances For
Reference shape-preserving reshape view.
Instances For
Reference seeded uniform-random tensor generation.
Instances For
Reference seeded Bernoulli-mask generation.
Instances For
Reference scaled contraction, distinguished from fixed-left ordinary matrix multiplication.
Instances For
A compound pullback keeps original cotangents through row normalization.
Instances For
Reference mean-squared-error loss.
Instances For
Weighted logits cross-entropy with both pullbacks supplied by the shared specification.
Instances For
Fixed-teacher cross-entropy using the shared loss and cancellation-resistant gradient.
Instances For
Reference generic channel-first convolution.
Instances For
Reference generic channel-first transpose convolution.
Instances For
Reference smooth max pooling.
Instances For
Reference attention with fixed-order arithmetic and finite-coefficient range repair.
Instances For
Cross-platform reference capsules.