Contents

namespace

SushiAI::Data

Declared in
include/SushiAI/data/dataset.hpp

Contains

Typedefs

using SushiAI::Data::DatasetFactory = std::unique_ptr<Dataset> (*)(SushiBLAS::Engine& engine, const Config::Value& attributes, std::string_view context)

Builds one dataset from its configuration attributes.

Parameters

engine

The engine that allocates and fills the tensors.

attributes

The dataset's own keys; the factory rejects any it does not know.

context

What to call this dataset in a diagnostic.

Returns

The dataset.

Variables

constexpr std::array< DatasetEntry, 2 > DATASET_REGISTRY = { DatasetEntry{"rings", &make_rings}, DatasetEntry{"mnist", &make_mnist}, }

Every dataset type a configuration file may name.

A file-scope constant table; nothing self-registers. See config/registry.hpp for why that is forced rather than preferred.

Functions

bool mnist_available(const MnistOptions &options)

Whether the IDX files for options are present and readable.

Parameters

options

Where to look and which split.

Returns

True when both the image and label files exist.

std::string mnist_expected_paths(const MnistOptions &options)

The path pair mnist_available checks, for a diagnostic message.

Parameters

options

Where to look and which split.

Returns

"images: <path>, labels: <path>".

std::unique_ptr< Dataset > try_load_mnist(SushiBLAS::Engine &engine, const MnistOptions &options={})

Loads MNIST from IDX files, returning nullptr if absent.

Parameters

engine

Engine allocating device tensors.

options

Directory, split, and sample count limits.

Returns

Loaded dataset or nullptr when files are missing.

Exceptions

Error

If an existing IDX file is malformed.

std::unique_ptr< Dataset > make_rings(SushiBLAS::Engine &engine, const Config::Value &attributes, std::string_view context)

Builds a Rings dataset from configuration attributes.

Parameters

attributes

Dataset parameters dictionary.

context

Diagnostic context string.

Returns

Constructed dataset instance.

Exceptions

Error

If an attribute key is unknown or value is invalid.

std::unique_ptr< Dataset > make_mnist(SushiBLAS::Engine &engine, const Config::Value &attributes, std::string_view context)

Builds the MNIST dataset from configuration attributes.

Reads "directory" (required), "split" ("train" or "test"), "batch_size" and "max_samples". A relative directory is used as given, so it resolves against the working directory of the process.

Returns

The loaded dataset; never null.

std::unique_ptr< Dataset > make_dataset(SushiBLAS::Engine &engine, std::string_view type, const Config::Value &attributes, std::string_view context)

Builds the dataset named type from the registry.

Parameters

type

Registry key identifying dataset implementation.

attributes

Dataset configuration attributes.

Returns

Constructed dataset instance.

Exceptions

Error

If type is not registered.