
    x-j^                        d Z ddlZddlZddlZddlZddlmZ g ZdZ	e	dz   Z
dZe	dz   ZdZe	d	z   Zd
Ze	dz   ZdZd Z edddd          d             Z edddd          d             Z edddd          d             ZdS )z
MNIST dataset.

This module will download dataset from http://yann.lecun.com/exdb/mnist/ and
parse training set and test set into paddle reader creators.
    N)
deprecatedz$https://dataset.bj.bcebos.com/mnist/zt10k-images-idx3-ubyte.gz 9fb629c4189551a2d022fa330f9573f3zt10k-labels-idx1-ubyte.gz ec29112dd5afa0611ce80d1b7f02629cztrain-images-idx3-ubyte.gz f68b3c2dcbeaaa9fbdd348bbdeb94873ztrain-labels-idx1-ubyte.gz d53e105ee54ea40749a09fcbcd1e9432c                       fd}|S )Nc               3     K   t          j        d          5 } |                                 }t          j        d          5 }|                                }d}d}d}t          j        |||          \  }}}	}
|t          j        |          z  }d}d}t          j        |||          \  }}|t          j        |          z  }	 ||k    rndt                    z   dz   }t          j        |||          }|t          j        |          z  }|z  }dt          |	z  |
z            z   dz   }t          j        |||          }t          j        ||	|
z  f          	                    d          }|t          j        |          z  }|d	z  }|d
z  }|dz
  }t                    D ]%}||d d f         t          ||                   fV  &
	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nrbr   z>IIIIz>IIT>Bfloat32g     o@g       @g      ?)gzipGzipFilereadstructunpack_fromcalcsizestrnumpyreshapeastyperangeint)
image_fileimg_buf
label_filelab_buf
step_label
offset_imgmagic_byte_img	magic_img	image_numrowscols
offset_labmagic_byte_lab	magic_lab	label_num	fmt_labellabels
fmt_imagesimages_tempimagesibuffer_sizeimage_filenamelabel_filenames                        T/var/www/html/banglarbhumi/venv/lib/python3.11/site-packages/paddle/dataset/mnist.pyreaderzreader_creator.<locals>.reader+   s     ]>400 /	;J oo''G~t44 -;
$//++

 ")393E"GZ4 40	9dD fon===

!&'-'9"GZ( ($	9 fon===
;!Y.. #c+&6&6 6 <I#/	7JOOF&/)"<"<<J+-J!$s;+=+D'E'E!E!KJ"("4"GZ# #K #]#k4$;%? fY''  &/*"="==J#e^F#c\F#c\F";// ; ;$QTlCq	NN:::::-;3-; -; -; -; -; -; -; -; -; -; -; -; -; -; -;/	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	; /	;s6   *G4FGG4G 	 G4#G 	$G44G8;G8 )r0   r1   r/   r3   s   ``` r2   reader_creatorr5   *   s0    0; 0; 0; 0; 0; 0; 0;d M    z2.0.0zpaddle.vision.datasets.MNIST   z>Please use new dataset API which supports paddle.io.DataLoader)since	update_tolevelreasonc                      t          t          j        j                            t
          dt                    t          j        j                            t          dt                    d          S )z
    MNIST training set creator.

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

    :return: Training reader creator
    :rtype: callable
    mnistd   )	r5   paddledatasetcommondownloadTRAIN_IMAGE_URLTRAIN_IMAGE_MD5TRAIN_LABEL_URLTRAIN_LABEL_MD5r4   r6   r2   trainrG   `   s[      &&Wo	
 	
 	&&Wo	
 	
 	  r6   c                      t          t          j        j                            t
          dt                    t          j        j                            t          dt                    d          S )z
    MNIST test set creator.

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

    :return: Test reader creator.
    :rtype: callable
    r=   r>   )	r5   r?   r@   rA   rB   TEST_IMAGE_URLTEST_IMAGE_MD5TEST_LABEL_URLTEST_LABEL_MD5r4   r6   r2   testrM   {   sM      &&~wOO&&~wOO  r6   c                     t           j        j                            t          dt
                     t           j        j                            t          dt                     t           j        j                            t          dt                     t           j        j                            t          dt                     d S )Nr=   )r?   r@   rA   rB   rC   rD   rE   rF   rI   rJ   rK   rL   r4   r6   r2   fetchrO      s~     N""?G_MMM
N""?G_MMM
N"">7NKKK
N"">7NKKKKKr6   )__doc__r   r   r   paddle.dataset.commonr?   paddle.utilsr   __all__
URL_PREFIXrI   rJ   rK   rL   rC   rD   rE   rF   r5   rG   rM   rO   r4   r6   r2   <module>rU      sd           # # # # # #
3
993993;;4;;43 3 3l 
,
K	    * 
,
K	    " 
,
K	  L L L L Lr6   