U
    q±Ëh–  ã                   @  sj   d dl mZ d dlZd dlmZ ddddddœdd„ZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZ	dS )é    )ÚannotationsN)ÚOpRunz
np.ndarrayÚint)ÚdataÚshapeÚ	allowzeroÚreturnc                 C  sD   t  |¡}|dkr4t  |dk¡}t  | j¡| ||< t  | |¡}|S ©Nr   )ÚnpÚcopyÚwhereÚarrayr   Zreshape)r   r   r   Z	new_shapeZzeros_indexZreshaped© r   úA/tmp/pip-unpacked-wheel-xnis5xre/onnx/reference/ops/op_reshape.pyÚ reshape_reference_implementation   s    
r   c                   @  s   e Zd Zdd„ ZdS )ÚCommonReshapec                 C  s   t ||dƒfS r	   )r   )Úselfr   r   r   r   r   Ú_run   s    zCommonReshape._runN©Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   r   c                   @  s   e Zd ZdS )Ú	Reshape_5N)r   r   r   r   r   r   r   r      s   r   c                   @  s   e Zd Zddd„ZdS )Ú
Reshape_14Nc                 C  s0   |d krt | ddƒdk}n|dk}t|||ƒfS )Nr   r   é   )Úgetattrr   )r   r   r   r   r   r   r   r   "   s    zReshape_14._run)Nr   r   r   r   r   r   !   s   r   )r   )
Ú
__future__r   Znumpyr
   Zonnx.reference.op_runr   r   r   r   r   r   r   r   r   Ú<module>   s    ÿ