TorchLean API

NN.Examples.Data.Loaders.Npy

NPY loader tutorial (NumPy/PyTorch interop) #

This tutorial shows how to train from .npy files (NumPy arrays), similar to a common PyTorch workflow where you:

  1. prepare X.npy / y.npy in Python (NumPy / PyTorch),
  2. then train a model in TorchLean by loading those files.

Generate small deterministic .npy files with python3 NN/Examples/Data/generate_small_data.py:

Build:

The tutorial code is compiled with the rest of TorchLean and is directly runnable as scripts/lake.sh exe torchlean data_npy. It checks the array metadata before constructing the typed dataset, then trains through the same public trainer used by the model examples.

Optional flags (tutorial-specific):

Public API used here:

Command name used in diagnostics and by the top-level example runner.

Instances For

    Two input features, matching the generated .npy arrays.

    Instances For

      Hidden width, kept the same as the CSV tutorial so the two can be compared directly.

      Instances For

        One regression target.

        Instances For

          A small 2-layer batched MLP 2 -> 8 -> 1.

          Instances For

            Validate the two NPY shapes and return their shared leading-axis size.

            Instances For

              Command-line help for the NPY loader tutorial.

              Instances For

                Entry point: load the NumPy arrays, then train the same MLP the CSV tutorial trains.

                Instances For