# Path: cortex/plugins.py
# class DatasetPlugin(DatasetPluginBase):
#         class IndexingDataset(C):
# class ModelPlugin(ModelPluginBase):
#     def copy_to_local_path(self, from_path: str) -> str:
#     def add_dataset(self, mode: str, dataset: Dataset):
#     def set_dataloader_class(self, dataloader_class: type):
#     def get_path(self, source: str):
#     def set_input_names(self, input_names):
#     def set_dims(self, **kwargs):
#     def set_scale(self, scale):
#     def make_indexing(self, C):
#             def __getitem__(self, index):
#     def build(self, *args, **kwargs):
#     def routine(self, *args, **kwargs):
#     def visualize(self, *args, **kwargs):
#     def train_step(self):
#     def eval_step(self):
#     def optimizer_step(self):
#     def train_loop(self):
#     def eval_loop(self):
#     def get_dims(self, *queries):
#     def add_noise(self, key, dist=None, size=None, **kwargs):
#     def add_image(self, *args, **kwargs):
#     def add_histogram(self, *args, **kwargs):
#     def add_scatter(self, *args, **kwargs):
# def register_plugin(plugin):
# 
# Path: cortex/built_ins/datasets/utils.py
# def build_transforms(normalize=True, center_crop=None, image_size=None,
#                      random_crop=None, flip=None, random_resize_crop=None,
#                      random_sized_crop=None, use_sobel=False):
#     """
# 
#     Args:
#         normalize:
#         center_crop:
#         image_size:
#         random_crop:
#         flip:
#         random_resize_crop:
#         random_sized_crop:
#         use_sobel:
# 
#     Returns:
# 
#     """
#     transform_ = []
# 
#     if random_resize_crop:
#         transform_.append(transforms.RandomResizedCrop(random_resize_crop))
#     elif random_crop:
#         transform_.append(transforms.RandomCrop(random_crop))
#     elif center_crop:
#         transform_.append(transforms.CenterCrop(center_crop))
#     elif random_sized_crop:
#         transform_.append(transforms.RandomSizedCrop(random_sized_crop))
# 
#     if image_size:
#         if isinstance(image_size, int):
#             image_size = (image_size, image_size)
#         transform_.append(transforms.Resize(image_size))
# 
#     if flip:
#         transform_.append(transforms.RandomHorizontalFlip())
# 
#     transform_.append(transforms.ToTensor())
# 
#     if normalize:
#         if isinstance(normalize, transforms.Normalize):
#             transform_.append(normalize)
#         else:
#             transform_.append(transforms.Normalize(*normalize))
#     transform = transforms.Compose(transform_)
#     return transform


from os import path
from torchvision.transforms import transforms
from cortex.plugins import DatasetPlugin, register_data
from cortex.built_ins.datasets.utils import build_transforms
import torchvision
            test_path = path.join(data_path, 'val')

        if copy_to_local:
            train_path = self.copy_to_local_path(train_path)
            test_path = self.copy_to_local_path(test_path)

        if normalize and isinstance(normalize, bool):
            if tanh_normalization:
                normalize = transforms.Normalize((0.5, 0.5, 0.5),
                                                 (0.5, 0.5, 0.5))
            else:
                normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                                 std=[0.229, 0.224, 0.225])

        if source == 'imagenet':
            normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                             std=[0.229, 0.224, 0.225])
            train_transform = transforms.Compose([
                transforms.RandomResizedCrop(224),
                transforms.RandomHorizontalFlip(),
                transforms.ToTensor(),
                normalize,
            ])
            test_transform = transforms.Compose([
                transforms.Resize(256),
                transforms.CenterCrop(224),
                transforms.ToTensor(),
                normalize,
            ])
        else:

# Path: cortex/plugins.py
# class DatasetPlugin(DatasetPluginBase):
#         class IndexingDataset(C):
# class ModelPlugin(ModelPluginBase):
#     def copy_to_local_path(self, from_path: str) -> str:
#     def add_dataset(self, mode: str, dataset: Dataset):
#     def set_dataloader_class(self, dataloader_class: type):
#     def get_path(self, source: str):
#     def set_input_names(self, input_names):
#     def set_dims(self, **kwargs):
#     def set_scale(self, scale):
#     def make_indexing(self, C):
#             def __getitem__(self, index):
#     def build(self, *args, **kwargs):
#     def routine(self, *args, **kwargs):
#     def visualize(self, *args, **kwargs):
#     def train_step(self):
#     def eval_step(self):
#     def optimizer_step(self):
#     def train_loop(self):
#     def eval_loop(self):
#     def get_dims(self, *queries):
#     def add_noise(self, key, dist=None, size=None, **kwargs):
#     def add_image(self, *args, **kwargs):
#     def add_histogram(self, *args, **kwargs):
#     def add_scatter(self, *args, **kwargs):
# def register_plugin(plugin):
# 
# Path: cortex/built_ins/datasets/utils.py
# def build_transforms(normalize=True, center_crop=None, image_size=None,
#                      random_crop=None, flip=None, random_resize_crop=None,
#                      random_sized_crop=None, use_sobel=False):
#     """
# 
#     Args:
#         normalize:
#         center_crop:
#         image_size:
#         random_crop:
#         flip:
#         random_resize_crop:
#         random_sized_crop:
#         use_sobel:
# 
#     Returns:
# 
#     """
#     transform_ = []
# 
#     if random_resize_crop:
#         transform_.append(transforms.RandomResizedCrop(random_resize_crop))
#     elif random_crop:
#         transform_.append(transforms.RandomCrop(random_crop))
#     elif center_crop:
#         transform_.append(transforms.CenterCrop(center_crop))
#     elif random_sized_crop:
#         transform_.append(transforms.RandomSizedCrop(random_sized_crop))
# 
#     if image_size:
#         if isinstance(image_size, int):
#             image_size = (image_size, image_size)
#         transform_.append(transforms.Resize(image_size))
# 
#     if flip:
#         transform_.append(transforms.RandomHorizontalFlip())
# 
#     transform_.append(transforms.ToTensor())
# 
#     if normalize:
#         if isinstance(normalize, transforms.Normalize):
#             transform_.append(normalize)
#         else:
#             transform_.append(transforms.Normalize(*normalize))
#     transform = transforms.Compose(transform_)
#     return transform


# Path: cortex/built_ins/datasets/imagenet.py
from os import path
from torchvision.transforms import transforms
from cortex.plugins import DatasetPlugin, register_data
from cortex.built_ins.datasets.utils import build_transforms
import torchvision

            test_path = path.join(data_path, 'val')

        if copy_to_local:
            train_path = self.copy_to_local_path(train_path)
            test_path = self.copy_to_local_path(test_path)

        if normalize and isinstance(normalize, bool):
            if tanh_normalization:
                normalize = transforms.Normalize((0.5, 0.5, 0.5),
                                                 (0.5, 0.5, 0.5))
            else:
                normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                                 std=[0.229, 0.224, 0.225])

        if source == 'imagenet':
            normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                             std=[0.229, 0.224, 0.225])
            train_transform = transforms.Compose([
                transforms.RandomResizedCrop(224),
                transforms.RandomHorizontalFlip(),
                transforms.ToTensor(),
                normalize,
            ])
            test_transform = transforms.Compose([
                transforms.Resize(256),
                transforms.CenterCrop(224),
                transforms.ToTensor(),
                normalize,
            ])
        else:

            train_transform = build_transforms(