TorchLean API

NN.Examples.Quickstart.SimpleMlpTrain

Simple MLP training example (regression) #

This is a focused end-to-end example of training a small MLP in TorchLean.

It mirrors the simplest PyTorch workflow:

  1. build a small synthetic dataset (in-memory),
  2. define an MLP (Linear -> ReLU -> Linear),
  3. train with Adam,
  4. report loss before/after, plus a few sample predictions.

Run:

Optional flags (tutorial-specific):

Default JSON log path used only when the user explicitly passes --log.

Instances For

    Small piecewise-linear regression target:

    y = 0.8 * relu(x1 + x2) - 0.4 * relu(x2 - x1) + 0.2.

    This is a natural fit for a small ReLU MLP, which keeps the command dependable.

    Instances For

      Build the tutorial dataset at the runtime-selected scalar type.

      Data.regression2to1Grid keeps shape-indexed tensor slicing out of the first training example. The underlying value is still a TorchLean supervised dataset with checked input/output shapes.

      Instances For

        Command-line help for the simple MLP quickstart.

        Instances For