ncalab.data.growingncadataset

Classes

GrowingNCADataset

An abstract class representing a Dataset.

Module Contents

class ncalab.data.growingncadataset.GrowingNCADataset(image: numpy.ndarray, num_channels: int, batch_size: int = 8)

Bases: torch.utils.data.Dataset

An abstract class representing a Dataset.

All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite __getitem__(), supporting fetching a data sample for a given key. Subclasses could also optionally overwrite __len__(), which is expected to return the size of the dataset by many Sampler implementations and the default options of DataLoader. Subclasses could also optionally implement __getitems__(), for speedup batched samples loading. This method accepts list of indices of samples of batch and returns list of samples.

Note

DataLoader by default constructs an index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.

Dedicated dataset for “growing” tasks, like growing emoji.

The idea is to train a model solely for the purpose to generate (“grow”) a fixed image. Hence, this Dataset class only stores multiple copies of the same image.

Parameters:
  • [np.ndarray] (image) – Input image.

  • [int] (batch_size) – Total number of image channels (including hidden)

  • [int] – Output batch size. Defaults to 8.

batch_size = 8
image
seed
__len__()
__getitem__(idx)