σ
ίΖχXc           @@  se   d  d l  m Z d d l m Z d d l m Z d d l m Z d  d l	 Z
 d  d l Z d   Z d S(	   i    (   t   absolute_importi   (   t
   load_batchi   (   t   get_file(   t   backendNc          C@  sΏ  d }  d } t  |  d | d t } d } t j | d d d f d d	 } t j | f d d	 } x t d
 d  D] } t j j | d t |   } t	 |  \ } }	 | | | d
 d | d  d d  d d  d d  f <|	 | | d
 d | d +qs Wt j j | d  } t	 |  \ }
 } t j
 | t |  d
 f  } t j
 | t |  d
 f  } t j   d k r©| j d d d d
  } |
 j d d d d
  }
 n  | | f |
 | f f S(   sq   Loads CIFAR10 dataset.

    # Returns
        Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`.
    s   cifar-10-batches-pys6   http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gzt   origint   untariPΓ  i   i    t   dtypet   uint8i   i   t   data_batch_i'  Nt
   test_batcht   channels_lasti    i   (   R   t   Truet   npt   zerost   ranget   ost   patht   joint   strR   t   reshapet   lent   Kt   image_data_formatt	   transpose(   t   dirnameR   R   t   num_train_samplest   x_traint   y_traint   it   fpatht   datat   labelst   x_testt   y_test(    (    s5   /tmp/pip-build-X4mzal/keras/keras/datasets/cifar10.pyt	   load_data	   s&    !:(   t
   __future__R    t   cifarR   t   utils.data_utilsR   t    R   R   t   numpyR   R   R"   (    (    (    s5   /tmp/pip-build-X4mzal/keras/keras/datasets/cifar10.pyt   <module>   s   