Skip to main content

Module mlp

Module mlp 

Source
Expand description

Multi-layer perceptron (MLP) core.

The low-level API is intentionally allocation-free:

  • Mlp::forward writes activations into a reusable Scratch and returns a slice.
  • Mlp::backward writes gradients into a reusable Gradients.

Shape mismatches are treated as programmer error and will panic via assert!.

Structsยง

BatchBackpropScratch
Reusable buffers for Mlp::backward_batch.
BatchScratch
Reusable buffers for Mlp::forward_batch.
Gradients
Parameter gradients for an Mlp (overwrite semantics).
Mlp
A feed-forward multi-layer perceptron composed of dense layers.
Scratch
Reusable buffers for Mlp::forward.
Trainer
Reusable buffers for training a specific Mlp.