Skip to content

Conversation

@fmassa
Copy link
Member

@fmassa fmassa commented Mar 4, 2021

This is needed for some internal tests, adding this back for now

@fmassa fmassa merged commit 668927e into pytorch:master Mar 4, 2021
@fmassa fmassa deleted the add-back-cifar-datagen branch March 4, 2021 12:52
@pmeier
Copy link
Contributor

pmeier commented Mar 8, 2021

@fmassa if someone depends on the old fake data generation, they could use this instead:

import contextlib

from test_datasets import CIFAR10TestCase, CIFAR100
from common_utils import get_tmp_dir


@contextlib.contextmanager
def dataset_root_from_test_case(cls, config=None):
    if config is None:
        cls._populate_private_class_attributes()
        config = cls._DEFAULT_CONFIG

    with get_tmp_dir() as root:
        test_case = cls()
        test_case.inject_fake_data(root, config)

        yield root


@contextlib.contextmanager
def cifar_root(version):
    with dataset_root_from_test_case(CIFAR10TestCase if version == "CIFAR10" else CIFAR100) as root:
        yield root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants