
    bIg                    N    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e      Z	y)    )annotationsN)Base)expectc                      e Zd Zed	d       Zed	d       Zed	d       Zed	d       Zed	d       Zed	d       Z	ed	d       Z
y)
	ReduceSumc                    g d} t        j                  dgt         j                        }d}t        j                  j                  dddgdg|	      }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                        }t        j                  |t        |j                               |dk(        }t        |||g|gd       t         j                  j                  d       t         j                  j                  dd|       j                  t         j                        }t        j                  |t        |j                               |dk(        }t        |||g|gd       y )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   s         b/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/backend/test/case/node/reducesum.pyexport_do_not_keepdimsz ReduceSum.export_do_not_keepdims   sF   xx288,{{$$ 09+PX % 
 xx!fq!fAA/1b'B81DERZZ
 &&E$++-$88q=Q 	$<I:		
 			qyy  b%077

C&&E$++-$88q=Q$<I9		
    c                    g d} t        j                  dgt         j                        }d}t        j                  j                  dddgdg|      }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                        }t        j                  |t        |j                               |dk(        }t        |||g|gd       t         j                  j                  d       t         j                  j                  dd|       j                  t         j                        }t        j                  |t        |j                               |dk(        }t        |||g|gd       y )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&   r5   s         r8   export_keepdimszReduceSum.export_keepdims3   sF   xx288,{{$$ 09+PX % 
 xx!fq!fAA/1b'B81DERZZ
 &&E$++-$88q=Q 	$<I3		
 			qyy  b%077

C&&E$++-$88q=Q$<I2		
r:   c                    g d} t        j                  g t         j                        }d}t        j                  j                  dddgdg|      }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                        }t        j                  |d |dk(        }t        |||g|gd       t         j                  j                  d       t         j                  j                  dd|       j                  t         j                        }t        j                  |d |dk(        }t        |||g|gd       y )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   r1   r2   r3   r4   r5   s         r8   export_default_axes_keepdimsz&ReduceSum.export_default_axes_keepdimsX   s.   xx"((+{{$$ 09+PX % 
 xx!fq!fAA/1b'B81DERZZ
 &&D8q=A 	$<I@		
 			qyy  b%077

C&&D8q=A$<I?		
r:   c                    g d} t        j                  dgt         j                        }d}t        j                  j                  dddgdg|	      }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                        }t        j                  |t        |j                               |dk(        }t        |||g|gd       t         j                  j                  d       t         j                  j                  dd|       j                  t         j                        }t        j                  |t        |j                               |dk(        }t        |||g|gd       y )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&   r5   s         r8   export_negative_axes_keepdimsz'ReduceSum.export_negative_axes_keepdims{   sF   xxBHH-{{$$ 09+PX % 
 xx!fq!fAA/1b'B81DERZZ
 &&E$++-$88q=Q 	$<IA		
 			qyy  b%077

C&&E$++-$88q=Q$<I@		
r:   c                 r   g 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
                        }t        j                  g t        j                        }t        j                  |      }t        |||g|gd       t        j                  j                  d       t        j                  j                  dd|       j                  t        j
                        }t        j                  |      }t        |||g|gd       y )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   r1   r2   r3   r4   )r6   r   r7   r   r   r   s         r8   export_empty_axes_input_noopz&ReduceSum.export_empty_axes_input_noop   s!   {{$$F#K!% % 
 xx!fq!fAA/1b'B81DERZZ
 xx"((+((4. 	$<I@		
 			qyy  b%077

C((4.$<I8		
r:   c                    g d} d}g d}t         j                  j                  dddgdg|      }t        j                  g t        j
                  	      j                  |       }t        j                  dgt        j                  	      }t        j                  t        j                  |t        j
                  	            }t        |||g|gd
       y)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   r6   r   reduced_shaper7   r   r   r   s          r8   export_empty_setzReduceSum.export_empty_set   s     !{{$$F#K	 % 
 xx"**-55e<xx288,((288MDE$<I,		
r:   c                    g d} d}g d}t         j                  j                  dddgdg|      }t        j                  g t        j
                  	      j                  |       }t        j                  d
gt        j                  	      }t        j                  g t        j
                  	      j                  |      }t        |||g|gd       y)z1Test case with the non-reduced-axis of size zero.rN   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-   rP   r)   r   rR   s          r8   export_non_reduced_axis_zeroz&ReduceSum.export_non_reduced_axis_zero   s     !{{$$F#K	 % 
 xx"**-55e<xx288,((2RZZ088G$<IB		
r:   N)returnNone)__name__
__module____qualname__staticmethodr9   r>   rB   rG   rL   rT   rW    r:   r8   r   r      s    "
 "
H "
 "
H  
  
D "
 "
H $
 $
L 
 
0 
 
r:   r   )

__future__r   numpyr'   r*   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r^   r:   r8   <module>rc      s$    #   , .j
 j
r:   