vkML 0.1.0

Compose

Run several transforms in order, threading one generator through them.

class Composepython/vkml/data.py:272

One generator, not one each: two transforms seeded independently draw the same numbers whenever their call counts line up, which is the classic way correlated "randomness" gets into an augmentation pipeline.

Three transforms ship, not a library. Compose, RandomHorizontalFlip and RandomCrop are the standard CIFAR augmentation, and between them they exercise every part of the contract: composition, a per-sample random decision, and a shape-changing spatial operation. Anything else is a five-line function with the same signature, and a transform zoo would be a maintenance surface built ahead of a user.

ⓘ Note

Every shipped transform decides per sample, not per batch. A flip that draws one coin for the whole batch is not augmentation — it doubles the dataset instead of multiplying it, and it correlates every sample in a step.

⚠ Warning

How that decision is applied was decided by measurement, and the usual rule lost. "Vectorise, never loop in Python" gave a crop 3.8× slower than sixty-four contiguous slices and a flip 3.3× slower than reversing only the chosen rows — both because the vectorised form does the work for samples it then discards. The output is byte-identical either way; only the cost differs.

Construction

__init__

def __init__self, *transformspython/vkml/data.py:280

Call

__call__

def __call__self, rng, arrays: tuple -> tuplepython/vkml/data.py:286

Internals

__repr__

def __repr__self -> strpython/vkml/data.py:291

See also DataLoader, ArrayDataset

vkML — Vulkan-first machine learning in C++20. Apache-2.0. Signatures on this page are generated from the installed module.