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
engineThe engine that allocates and fills the tensors.
attributesThe dataset's own keys; the factory rejects any it does not know.
contextWhat 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
optionsWhere 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
optionsWhere 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
engineEngine allocating device tensors.
optionsDirectory, split, and sample count limits.
Returns
Loaded dataset or nullptr when files are missing.
Exceptions
ErrorIf 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
attributesDataset parameters dictionary.
contextDiagnostic context string.
Returns
Constructed dataset instance.
Exceptions
ErrorIf 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
typeRegistry key identifying dataset implementation.
attributesDataset configuration attributes.
Returns
Constructed dataset instance.
Exceptions
ErrorIf
typeis not registered.

