# 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
                normalize=normalize, **transform_args)
            test_transform = build_transforms(normalize=normalize)
        train_set = Dataset(root=train_path, transform=train_transform)
        test_set = Dataset(root=test_path, transform=test_transform)
        input_names = ['images', 'targets', 'index']

        dim_c, dim_x, dim_y = train_set[0][0].size()

        print('Computing min / max...')

        img_min = 1000
        img_max = -1000
        for i in range(1000):
            img = train_set[i][0]
            img_min = min(img.min(), img_min)
            img_max = max(img.max(), img_max)

        dim_l = len(train_set.classes)

        dims = dict(x=dim_x, y=dim_y, c=dim_c, labels=dim_l)

        self.add_dataset('train', train_set)
        self.add_dataset('test', test_set)
        self.set_input_names(input_names)
        self.set_dims(**dims)

        self.set_scale((img_min, img_max))
        print('Finished loading dataset')



# 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

                normalize=normalize, **transform_args)
            test_transform = build_transforms(normalize=normalize)
        train_set = Dataset(root=train_path, transform=train_transform)
        test_set = Dataset(root=test_path, transform=test_transform)
        input_names = ['images', 'targets', 'index']

        dim_c, dim_x, dim_y = train_set[0][0].size()

        print('Computing min / max...')

        img_min = 1000
        img_max = -1000
        for i in range(1000):
            img = train_set[i][0]
            img_min = min(img.min(), img_min)
            img_max = max(img.max(), img_max)

        dim_l = len(train_set.classes)

        dims = dict(x=dim_x, y=dim_y, c=dim_c, labels=dim_l)

        self.add_dataset('train', train_set)
        self.add_dataset('test', test_set)
        self.set_input_names(input_names)
        self.set_dims(**dims)

        self.set_scale((img_min, img_max))
        print('Finished loading dataset')



register_data(ImageFolder)