TorchLean API

NN.Examples.Models.Common.RealData

Shared Real-Data Helpers for Model Examples #

NN/Examples/Models/* should exercise real data paths. This file centralizes the shared parts:

The data files are prepared by scripts/datasets/download_example_data.py; examples report missing inputs explicitly instead of silently falling back to synthetic tensors.

@[reducible, inline]
Instances For
    @[reducible, inline]
    Instances For
      @[reducible, inline]

      ImageNet-style converted image shape used by the higher-resolution diffusion example.

      Instances For
        @[reducible, inline]

        One-hot target shape for ImageNet-style folders.

        The diffusion example ignores labels, but reusing Data.LabeledSource keeps the data path identical to the supervised examples and lets class-directory conversion catch malformed labels early.

        Instances For

          Parse the shared flags for an ImageNet-style 64x64 NPY dataset.

          The expected input is produced by scripts/datasets/torchlean_data_convert.py image-folder; that converter handles JPEG/PNG decoding, RGB conversion, resizing, class-directory labels, and the final NCHW layout. Lean then reads only the simple .npy tensors.

          Instances For
            Instances For

              Load a user-prepared ImageNet-style 64x64 minibatch.

              This is intentionally a .npy reader, not a JPEG reader. The Python converter is the trust boundary for filesystem image decoding and resizing; this Lean path checks the resulting tensor shape and class range before handing the batch to examples.

              Instances For

                Load a CIFAR minibatch and expose it as a compact flattened vector batch.

                The file paths and download hints remain in NN.Examples, but the flattening logic itself lives in NN.API.Models.Generative so users can reuse it with their own image tensors.

                Instances For
                  def NN.Examples.Models.RealData.textCausalSample {α : Type} [API.Semantics.Scalar α] [API.Runtime.Scalar α] (seqLen vocab : ) (input : String) :
                  API.sample.Supervised α (Shape.Mat seqLen vocab) (Shape.Mat seqLen vocab)
                  Instances For