# Path: deeppy/base.py
# class ParamMixin(object):
# class PhaseMixin(object):
# class CollectionMixin(ParamMixin, PhaseMixin):
# class Model(ParamMixin):
# class PickleMixin(object):
#     def params(self):
#     def params(self, params):
#     def phase(self):
#     def phase(self, phase):
#     def params(self):
#     def params(self, params):
#     def phase(self):
#     def phase(self, phase):
#     def setup(self, *array_shapes):
#     def update(self, *arrays):
#     def _pickle_discard(self, attr_name):
#     def __getstate__(self):
# 
# Path: deeppy/dataset/util.py
# def touch(filepath, times=None):
# def require_dir(path):
# def url_filename(url):
# def download(url, target_dir, filename=None):
# def checkpoint(filepath):
# def is_archive(filepath):
# def archive_extract(filepath, target_dir):
# def checksum(filename, method='sha1'):
# def _read_int(buf):
# def load_idx(filepath):


import os
import pickle
import numpy as np
import logging
from ..base import float_, int_
from .util import dataset_home, download, checksum, archive_extract, checkpoint
_URL = 'http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz'
_SHA1 = '874905e36347c8536514d0a26261acf3bff89bc7'


class CIFAR10(object):
    '''
    The CIFAR-10 dataset [1]
    http://www.cs.toronto.edu/~kriz/cifar.html

    References:
    [1]: Learning Multiple Layers of Features from Tiny Images, Alex
         Krizhevsky, 2009.
    '''

    def __init__(self):
        self.name = 'cifar10'
        self.n_classes = 10
        self.n_test = 10000
        self.n_train = 50000
        self.img_shape = (3, 32, 32)
        self.data_dir = os.path.join(dataset_home, self.name)
        self._install()
        self._arrays = self._load()

    def arrays(self, flat=False, dp_dtypes=False):
        x_train, y_train, x_test, y_test = self._arrays
        if dp_dtypes:
            x_train = x_train.astype(float_)
            y_train = y_train.astype(int_)
            x_test = x_test.astype(float_)

# Path: deeppy/base.py
# class ParamMixin(object):
# class PhaseMixin(object):
# class CollectionMixin(ParamMixin, PhaseMixin):
# class Model(ParamMixin):
# class PickleMixin(object):
#     def params(self):
#     def params(self, params):
#     def phase(self):
#     def phase(self, phase):
#     def params(self):
#     def params(self, params):
#     def phase(self):
#     def phase(self, phase):
#     def setup(self, *array_shapes):
#     def update(self, *arrays):
#     def _pickle_discard(self, attr_name):
#     def __getstate__(self):
# 
# Path: deeppy/dataset/util.py
# def touch(filepath, times=None):
# def require_dir(path):
# def url_filename(url):
# def download(url, target_dir, filename=None):
# def checkpoint(filepath):
# def is_archive(filepath):
# def archive_extract(filepath, target_dir):
# def checksum(filename, method='sha1'):
# def _read_int(buf):
# def load_idx(filepath):


# Path: deeppy/dataset/cifar10.py
import os
import pickle
import numpy as np
import logging
from ..base import float_, int_
from .util import dataset_home, download, checksum, archive_extract, checkpoint

_URL = 'http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz'
_SHA1 = '874905e36347c8536514d0a26261acf3bff89bc7'


class CIFAR10(object):
    '''
    The CIFAR-10 dataset [1]
    http://www.cs.toronto.edu/~kriz/cifar.html

    References:
    [1]: Learning Multiple Layers of Features from Tiny Images, Alex
         Krizhevsky, 2009.
    '''

    def __init__(self):
        self.name = 'cifar10'
        self.n_classes = 10
        self.n_test = 10000
        self.n_train = 50000
        self.img_shape = (3, 32, 32)
        self.data_dir = os.path.join(dataset_home, self.name)
        self._install()
        self._arrays = self._load()

    def arrays(self, flat=False, dp_dtypes=False):
        x_train, y_train, x_test, y_test = self._arrays
        if dp_dtypes:
            x_train = x_train.astype(float_)
            y_train = y_train.astype(int_)
            x_test = x_test.astype(float_)

            y_test = y_test.astype(int_)