Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FBcode->GH] Add back cifar_root #3503

Merged
merged 2 commits into from
Mar 4, 2021

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
Collaborator

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