
    Αi                         S r SSKrSSKrSSKrSSKrSSKJr  / rSr	\	S-   r
Sr\	S-   rSrSS	 jr\" S
SSSS9S 5       r\" S
SSSS9S 5       r\" S
SSSS9SS j5       r\" S
SSSS9SS j5       r\" S
SSSS9S 5       rg)a,  
CIFAR dataset.

This module will download dataset from https://dataset.bj.bcebos.com/cifar/cifar-10-python.tar.gz and https://dataset.bj.bcebos.com/cifar/cifar-100-python.tar.gz, parse train/test set into
paddle reader creators.

The CIFAR-10 dataset consists of 60000 32x32 color images in 10 classes,
with 6000 images per class. There are 50000 training images and 10000 test
images.

The CIFAR-100 dataset is just like the CIFAR-10, except it has 100 classes
containing 600 images each. There are 500 training images and 100 testing
images per class.

    N)
deprecatedz$https://dataset.bj.bcebos.com/cifar/zcifar-10-python.tar.gz c58f30108f718f92721af3b95e74349azcifar-100-python.tar.gz eb9058c3a382ffc7106e4002c42a8d85c                 &   ^ ^^^ S mUU UU4S jnU$ )Nc              3      #    U S   nU R                  SU R                  SS 5      5      nUc   e[        X5       H4  u  p4US-  R                  [        R                  5      [        U5      4v   M6     g 7f)Ns   datas   labelss   fine_labelsg     o@)getzipastypenumpyfloat32int)batchdatalabelssamplelabels        T/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/dataset/cifar.py
read_batch"reader_creator.<locals>.read_batch0   sh     W~9eii&EF!!! .MFE>))%--8#e*DD /s   A1A3c               3     >#     [         R                  " TSS9 n U4S jU  5       nU H7  n[        R                  " U R	                  U5      SS9nT" U5       S h  vN   M9     S S S 5        T(       d  g Mq   N! , (       d  f       N= f7f)Nr)modec              3   `   >#    U  H#  nTUR                   ;   d  M  UR                   v   M%     g 7f)N)name).0	each_itemsub_names     r   	<genexpr>1reader_creator.<locals>.reader.<locals>.<genexpr>:   s*      %&	9>>1 #INN%&s   ..bytes)encoding)tarfileopenpickleloadextractfile)fnamesr   r   cyclefilenamer   r   s       r   readerreader_creator.<locals>.reader7   sz     hS1Q%& "D"KKd(;gNE)%000 " 2   1 21s/   B	AA8A6A8$B	6A88
BB	 )r*   r   r)   r+   r   s   ``` @r   reader_creatorr.   /   s    E   M    z2.0.0zpaddle.vision.datasets.Cifar100   z>Please use new dataset API which supports paddle.io.DataLoader)since	update_tolevelreasonc                  |    [        [        R                  R                  R	                  [
        S[        5      S5      $ )z
CIFAR-100 training set creator.

It returns a reader creator, each sample in the reader is image pixels in
[0, 1] and label in [0, 99].

:return: Training reader creator
:rtype: callable
cifartrainr.   paddledatasetcommondownloadCIFAR100_URLCIFAR100_MD5r-   r/   r   train100r?   J   s0      &&|WlK r/   c                  |    [        [        R                  R                  R	                  [
        S[        5      S5      $ )z
CIFAR-100 test set creator.

It returns a reader creator, each sample in the reader is image pixels in
[0, 1] and label in [0, 99].

:return: Test reader creator.
:rtype: callable
r6   testr8   r-   r/   r   test100rB   `   s0      &&|WlK r/   zpaddle.vision.datasets.Cifar10c                 z    [        [        R                  R                  R	                  [
        S[        5      SU S9$ )z
CIFAR-10 training set creator.

It returns a reader creator, each sample in the reader is image pixels in
[0, 1] and label in [0, 9].

:param cycle: whether to cycle through the dataset
:type cycle: bool
:return: Training reader creator
:rtype: callable
r6   
data_batchr)   r.   r9   r:   r;   r<   CIFAR10_URLCIFAR10_MD5rE   s    r   train10rI   v   3    $ &&{G[I r/   c                 z    [        [        R                  R                  R	                  [
        S[        5      SU S9$ )z
CIFAR-10 test set creator.

It returns a reader creator, each sample in the reader is image pixels in
[0, 1] and label in [0, 9].

:param cycle: whether to cycle through the dataset
:type cycle: bool
:return: Test reader creator.
:rtype: callable
r6   
test_batchrE   rF   rE   s    r   test10rM      rJ   r/   c                      [         R                  R                  R                  [        S[
        5        [         R                  R                  R                  [        S[        5        g )Nr6   )r9   r:   r;   r<   rG   rH   r=   r>   r-   r/   r   fetchrO      s<     NN"";E
NN""<,Gr/   )F)__doc__r$   r"   r   paddle.dataset.commonr9   paddle.utilsr   __all__
URL_PREFIXrG   rH   r=   r>   r.   r?   rB   rI   rM   rO   r-   r/   r   <module>rU      s        #
3
3305516 
/
K	  
/
K	  
.
K	& 
.
K	& 
.
K	HHr/   