o
    q::j÷  ã                   @  sP   d dl mZ d dl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                   @  sD   e Zd Zeddd„ƒZeddd„ƒZeddd„ƒZedd	d
„ƒZdS )ÚScanÚreturnÚNonec               	   C  s¦   t j d¡} t ddg¡ tj¡ d¡}t g d¢¡ tj¡ d¡}t ddg¡ tj¡ d¡}t g d¢¡ tj¡ d¡}t| ||g||gd	t j	 
d
d¡gd d S )Nap  
            y, z = Scan ("", initial, x) <
                num_scan_inputs = 1,
                body = scan_body (float[2] sum_in, float[2] next)
                    => (float[2] sum_out, float[2] scan_out)
                {
                    sum_out  = Add(sum_in, next)
                    scan_out = Identity(sum_out)
                }
            >
            r   )é   é   ©r   r	   é   é   é   é   )r   r   r	   é	   é   ©r   r	   r   r   r   r   Útest_scan_sumÚ é   ©ÚinputsÚoutputsÚnameÚopset_imports©ÚonnxÚparserÚ
parse_nodeÚnpÚarrayÚastypeÚfloat32Úreshaper   ÚhelperÚmake_opsetid©ÚnodeÚinitialÚxÚyÚz© r+   úg/home/nk/hobo-godmode/plappi-mvp/.venv/lib/python3.10/site-packages/onnx/backend/test/case/node/scan.pyÚexport_scan_8   s   ÿ
ûzScan.export_scan_8c               	   C  s¦   t j d¡} t ddg¡ tj¡ d¡}t g d¢¡ tj¡ d¡}t ddg¡ tj¡ d¡}t g d¢¡ tj¡ d¡}t| ||g||gd	t j	 
d
d¡gd d S )Nal  
            y, z = Scan (initial, x) <
                num_scan_inputs = 1,
                body = scan_body (float[2] sum_in, float[2] next)
                    => (float[2] sum_out, float[2] scan_out)
                {
                    sum_out  = Add(sum_in, next)
                    scan_out = Identity(sum_out)
                }
            >
            r   )r	   r
   ©r   r	   r   r   r   Útest_scan9_sumr   r   r   r%   r+   r+   r,   Úexport_scan_92   s   ÿ
ûzScan.export_scan_9c               	   C  sÊ   t j d¡} t ddg¡ tj¡}t ddg¡ tj¡}t g d¢¡ tj¡ d¡}t ddg¡ tj¡}t dd	g¡ tj¡}t g d
¢¡ tj¡ d¡}t| |||g|||gdt j	 
dd¡gd d S )Naá  
            y_sum, y_prod, z = Scan (initial_sum, initial_prod, x) <
                num_scan_inputs = 1,
                body = scan_body (float[2] sum_in, float[2] prod_in, float[2] next)
                    => (float[2] sum_out, float[2] prod_out, float[2] scan_out)
                {
                    sum_out  = Add(sum_in, next)
                    prod_out = Mul(prod_in, next)
                    scan_out = Identity(sum_out)
                }
            >
            r   r   r
   r.   r   r   é   é0   r   Útest_scan9_multi_stater   r   r   )r&   Úinitial_sumÚinitial_prodr(   Úy_sumÚy_prodr*   r+   r+   r,   Úexport_scan_9_multi_stateT   s    ÿ
ûzScan.export_scan_9_multi_statec               	   C  sv   t j d¡} t d¡}t g d¢¡ tj¡}t d¡}t g d¢¡ tj¡}t| ||g||gdt j 	dd¡gd	 d S )
Na`  
            y, z = Scan (initial, x) <
                num_scan_inputs = 1,
                body = scan_body (float sum_in, float next)
                    => (float sum_out, float scan_out)
                {
                    sum_out  = Add(sum_in, next)
                    scan_out = Identity(sum_out)
                }
            >
            g        )r   r	   r   r   r   g      .@)r   r   r   é
   r1   Útest_scan9_scalarr   r   r   )
r   r   r   r   r!   r   r    r   r#   r$   r%   r+   r+   r,   Úexport_scan_9_scalar}   s   ÿ


ûzScan.export_scan_9_scalarN)r   r   )Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr-   r0   r8   r;   r+   r+   r+   r,   r      s    "!(r   )Ú
__future__r   Únumpyr   r   Úonnx.parserÚonnx.backend.test.case.baser   Úonnx.backend.test.case.noder   r   r+   r+   r+   r,   Ú<module>   s   