vegans.utils.loading package

Submodules

vegans.utils.loading.CIFAR100Loader module

class vegans.utils.loading.CIFAR100Loader.CIFAR100Loader(root=None)[source]

Bases: vegans.utils.loading.CIFAR10Loader.CIFAR10Loader

static _preprocess(X_train, y_train, X_test, y_test)[source]

Preprocess mnist by normalizing and padding.

vegans.utils.loading.CIFAR10Loader module

class vegans.utils.loading.CIFAR10Loader.CIFAR10Loader(root=None)[source]

Bases: vegans.utils.loading.MNISTLoader.MNISTLoader

static _preprocess(X_train, y_train, X_test, y_test)[source]

Preprocess mnist by normalizing and padding.

load_adversary(x_dim=(3, 32, 32), y_dim=10, adv_type='Discriminator')[source]

Loads a working adversary architecture

load_autoencoder(z_dim=64, y_dim=10)[source]

Loads a working autoencoder architecture

load_decoder(z_dim=64, y_dim=10)[source]

Loads a working generator architecture

load_encoder(x_dim=(3, 32, 32), z_dim=64, y_dim=10)[source]

Loads a working encoder architecture

load_generator(x_dim=(3, 32, 32), z_dim=64, y_dim=10)[source]

Loads a working generator architecture

vegans.utils.loading.CelebALoader module

class vegans.utils.loading.CelebALoader.CelebALoader(root=None, batch_size=32, max_loaded_images=5000, crop_size=128, output_shape=64, verbose=False, **kwargs)[source]

Bases: vegans.utils.loading.DatasetLoader.DatasetLoader

__init__(root=None, batch_size=32, max_loaded_images=5000, crop_size=128, output_shape=64, verbose=False, **kwargs)[source]
Parameters
  • batch_size (int) – batch size during training.

  • max_loaded_images (int) – Number of examples loaded into memory, before new batch is loaded.

  • kwargs – Other input arguments to torchvision.utils.data.DataLoader

load_adversary(x_dim=None, y_dim=40, adv_type='Discriminator')[source]

Loads a working adversary architecture

load_autoencoder(x_dim=None, y_dim=40)[source]

Loads a working autoencoder architecture

load_decoder(x_dim=None, z_dim=(16, 4, 4), y_dim=40)[source]

Loads a working generator architecture

load_encoder(x_dim=None, z_dim=(16, 4, 4), y_dim=40)[source]

Loads a working encoder architecture

load_generator(x_dim=None, z_dim=(16, 4, 4), y_dim=40)[source]

Loads a working generator architecture

vegans.utils.loading.DatasetLoader module

class vegans.utils.loading.DatasetLoader.DatasetLoader(metadata, root=None)[source]

Bases: abc.ABC

Class that downloads a dataset and caches it locally. Assumes that the file can be downloaded (i.e. publicly available via an URI)

So far available are:
_check_dataset_integrity_or_raise(path, expected_hash)[source]

Ensures that the dataset exists and its MD5 checksum matches the expected hash.

abstract _load_from_disk()[source]

Given a Path to the file and a DataLoaderMetadata object, returns train and test sets as numpy arrays. One can assume that the file exists and its MD5 checksum has been verified before this function is called

load()[source]

Load the dataset in memory, as numpy arrays. Downloads the dataset if it is not present _is_already_downloaded

abstract load_adversary()[source]

Loads a working adversary architecture

abstract load_autoencoder()[source]

Loads a working autoencoder architecture

abstract load_decoder()[source]

Loads a working generator architecture

abstract load_encoder()[source]

Loads a working encoder architecture

abstract load_generator()[source]

Loads a working generator architecture

class vegans.utils.loading.DatasetLoader.DatasetMetaData(directory, m5hashes)[source]

Bases: object

vegans.utils.loading.ExampleLoader module

class vegans.utils.loading.ExampleLoader.ExampleLoader[source]

Bases: vegans.utils.loading.DatasetLoader.DatasetLoader

load_adversary(x_dim, y_dim=None, adv_type='Discriminator')[source]

Loads a working adversary architecture

load_autoencoder(x_dim, y_dim=None)[source]

Loads a working autoencoder architecture

load_decoder(x_dim, z_dim, y_dim=None)[source]

Loads a working generator architecture

load_encoder(x_dim, z_dim, y_dim=None)[source]

Loads a working encoder architecture

load_generator(x_dim, z_dim, y_dim=None)[source]

Loads a working generator architecture

vegans.utils.loading.FashionMNISTLoader module

class vegans.utils.loading.FashionMNISTLoader.FashionMNISTLoader(root=None)[source]

Bases: vegans.utils.loading.MNISTLoader.MNISTLoader

vegans.utils.loading.MNISTLoader module

class vegans.utils.loading.MNISTLoader.MNISTLoader(root=None)[source]

Bases: vegans.utils.loading.DatasetLoader.DatasetLoader

static _preprocess(X_train, y_train, X_test, y_test)[source]

Preprocess mnist by normalizing and padding.

load_adversary(x_dim=(1, 32, 32), y_dim=10, adv_type='Discriminator')[source]

Loads a working adversary architecture

load_autoencoder(x_dim=(1, 32, 32), y_dim=10)[source]

Loads a working autoencoder architecture

load_decoder(x_dim=(1, 32, 32), z_dim=32, y_dim=10)[source]

Loads a working generator architecture

load_encoder(x_dim=(1, 32, 32), z_dim=32, y_dim=10)[source]

Loads a working encoder architecture

load_generator(x_dim=(1, 32, 32), z_dim=32, y_dim=10)[source]

Loads a working generator architecture

Module contents