U
    qh                     @  sD   d dl mZ d dlZd dlmZ G dd deZG dd deZdS )    )annotationsN)OpRunReduceNumpyc                   @  s   e Zd ZdddZdS )ReduceMean_1Nc                 C  sL   |d k	rt |nd }tj||||jd}|dkrFt|tjsFt|}|fS )NZaxiskeepdimsdtyper   )tuplenpmeanr   
isinstancendarrayarray)selfdataaxesr   res r   E/tmp/pip-unpacked-wheel-xnis5xre/onnx/reference/ops/op_reduce_mean.py_run   s
    
zReduceMean_1._run)NN__name__
__module____qualname__r   r   r   r   r   r      s   r   c                   @  s   e Zd ZdddZdS )ReduceMean_18N   r   c                 C  s   |  |r|r|fS | |}|dk}z6tj||||jd}|dkrZt|tjsZt|}W nB tk
r } z$td|j	d|d| d|W 5 d }~X Y nX |fS )Nr   r   zUnable to reduce shape z with axes=z and keepdims=.)
Zis_axes_emptyZhandle_axesr	   r
   r   r   r   r   	TypeErrorshape)r   r   r   r   Znoop_with_empty_axesr   er   r   r   r      s    
zReduceMean_18._run)Nr   r   r   r   r   r   r   r      s   r   )
__future__r   Znumpyr	   Zonnx.reference.ops._opr   r   r   r   r   r   r   <module>   s   
