
    bIg4                    B    d dl mZ d dlZd dlZd dlmZ  G d de      Zy)    )annotationsN)OpRunc                      e Zd ZdddZy)ImageDecoderc                   	 dd l }|j                  j                  t	        j
                  |j                                     }|dk(  r%t        j                  |      d d d d d d df   }|fS |dk(  rt        j                  |      }|fS |dk(  r@|j                  d      }t        j                  |      }t        j                  |d	      }|fS t        d
|d      # t        $ r}t        d      |d }~ww xY w)Nr   zYPillow must be installed to use the reference implementation of the ImageDecoder operatorBGRRGB	GrayscaleL   )axiszpixel_format=z is not supported.)	PIL.ImageImportErrorImageopenioBytesIOtobytesnparrayconvertexpand_dims
ValueError)selfencodedpixel_formatPILeimgdecodeds          `/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/reference/ops/op_image_decoder.py_runzImageDecoder._run   s    	
 iinnRZZ(9:;5 hhsmAq$B$J/G z U"hhsmG z [(++c"ChhsmGnnW15G z }\,<<NOPP  	k	s   C 	C7&C22C7N)r
   )r   z
np.ndarrayreturnztuple[np.ndarray])__name__
__module____qualname__r#        r"   r   r      s    r)   r   )
__future__r   r   numpyr   onnx.reference.op_runr   r   r(   r)   r"   <module>r-      s   
 # 	  '5 r)   