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:
- build a small synthetic dataset (in-memory),
- define an MLP (
Linear -> ReLU -> Linear), - train with Adam,
- report loss before/after, plus a few sample predictions.
Run:
lake exe torchlean quickstart_mlplake exe torchlean quickstart_mlp --steps 200 --dtype float32 --backend eagerlake exe torchlean quickstart_mlp --steps 200 --dtype float --backend eager
Optional flags (tutorial-specific):
--seed S(model init + any shuffling)--steps N
Default JSON log path used only when the user explicitly passes --log.
Instances For
Small piecewise-linear regression target:
$$ y=0.8\,\operatorname{ReLU}(x_1+x_2) -0.4\,\operatorname{ReLU}(x_2-x_1)+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.regressionGrid 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.