o
    wi                     @  sH   d dl mZ d dlZd dlZd dlmZ d dlmZ G dd deZ	dS )    )annotationsN)Base)expectc                   @  sn   e Zd ZedddZedddZedddZedd	d
ZedddZedddZ	edddZ
dS )	ReduceSumreturnNonec                  C  s   g d} t jdgt jd}d}tjjdddgdg|d	}t jdd
gddggddgddggddgddgggt jd}t j|t|	 |dkd}t
|||g|gdd t jd t jdd| t j}t j|t|	 |dkd}t
|||g|gdd d S )N      r
      dtyper   r   dataaxesreducedinputsoutputskeepdimsr
   r	                  	   
         axisr   'test_reduce_sum_do_not_keepdims_exampler   r   name&test_reduce_sum_do_not_keepdims_randomnparrayint64onnxhelper	make_nodefloat32sumtupletolistr   randomseeduniformastypeshaper   r   noder   r    r7   b/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/onnx/backend/test/case/node/reducesum.pyexport_do_not_keepdims   2   0
z ReduceSum.export_do_not_keepdimsc                  C  s   g d} t jdgt jd}d}tjjdddgdg|d}t jdd	gd
dggddgddggddgddgggt jd}t j|t|	 |dkd}t
|||g|gdd t jd t jdd| t j}t j|t|	 |dkd}t
|||g|gdd d S )Nr   r   r   r   r   r   r   r   r
   r	   r   r   r   r   r   r   r   r   r   r    test_reduce_sum_keepdims_exampler!   r   r#   test_reduce_sum_keepdims_randomr%   r4   r7   r7   r8   export_keepdims3   r:   zReduceSum.export_keepdimsc                  C  s   g d} t jg t jd}d}tjjdddgdg|d}t jdd	gd
dggddgddggddgddgggt jd}t j|d |dkd}t|||g|gdd t j	
d t j	dd| t j}t j|d |dkd}t|||g|gdd d S )Nr   r   r   r   r   r   r   r   r
   r	   r   r   r   r   r   r   r   r   r   r   -test_reduce_sum_default_axes_keepdims_exampler!   r   r#   ,test_reduce_sum_default_axes_keepdims_random)r&   r'   r(   r)   r*   r+   r,   r-   r   r0   r1   r2   r3   r4   r7   r7   r8   export_default_axes_keepdimsX   s2   0
z&ReduceSum.export_default_axes_keepdimsc                  C  s   g d} t jdgt jd}d}tjjdddgdg|d	}t jdd
gddggddgddggddgddgggt jd}t j|t|	 |dkd}t
|||g|gdd t jd t jdd| t j}t j|t|	 |dkd}t
|||g|gdd d S )Nr   r   r   r   r   r   r   r   r
   r	   r   r   r   r   r   r   r   r   r   r   .test_reduce_sum_negative_axes_keepdims_exampler!   r   r#   -test_reduce_sum_negative_axes_keepdims_randomr%   r4   r7   r7   r8   export_negative_axes_keepdims{   r:   z'ReduceSum.export_negative_axes_keepdimsc                  C  s   g d} d}t jjdddgdg|dd}tjdd	gd
dggddgddggddgddgggtjd}tjg tjd}t|}t|||g|gdd tj	d tj
dd| tj}t|}t|||g|gdd d S )Nr   r   r   r   r   r   T)r   r   r   noop_with_empty_axesr
   r	   r   r   r   r   r   r   r   r   r   r   -test_reduce_sum_empty_axes_input_noop_exampler!   r   r#   %test_reduce_sum_empty_axes_input_noop)r)   r*   r+   r&   r'   r,   r(   r   r0   r1   r2   r3   )r5   r   r6   r   r   r   r7   r7   r8   export_empty_axes_input_noop   s:   0


z&ReduceSum.export_empty_axes_input_noopc                  C  s   g d} d}g d}t jjdddgdg|d}tjg tjd	| }tjdgtjd	}ttj|tjd	}t	|||g|gd
d dS )z-Test case with the reduced-axis of size zero.r
   r   r   r   )r
   r   r   r   r   r   r   r   r   test_reduce_sum_empty_setr!   N)
r)   r*   r+   r&   r'   r,   reshaper(   zerosr   r5   r   reduced_shaper6   r   r   r   r7   r7   r8   export_empty_set   $   
zReduceSum.export_empty_setc                  C  s   g d} d}g d}t jjdddgdg|d}tjg tjd	| }tjd
gtjd	}tjg tjd	|}t|||g|gdd dS )z1Test case with the non-reduced-axis of size zero.rI   r   )r
   r   r   r   r   r   r   r   r   r
   /test_reduce_sum_empty_set_non_reduced_axis_zeror!   N)	r)   r*   r+   r&   r'   r,   rK   r(   r   rM   r7   r7   r8   export_non_reduced_axis_zero   rP   z&ReduceSum.export_non_reduced_axis_zeroN)r   r   )__name__
__module____qualname__staticmethodr9   r=   r@   rD   rH   rO   rR   r7   r7   r7   r8   r      s    $$"$&r   )

__future__r   numpyr&   r)   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r7   r7   r7   r8   <module>   s   