o
    to™ií  ã                   @  sV   d dl mZ d dlZd dlZd dlmZmZ G dd„ dejƒZedkr)e 	¡  dS dS )é    )ÚannotationsN)ÚparserÚprinterc                   @  s    e Zd Zd
dd„Zddd„Zd	S )ÚTestBasicFunctionsÚgraphúonnx.GraphProtoÚreturnÚNonec                 C  sR   |   t|jƒd¡ |   |jd jd¡ |   |jd jd¡ |   |jd jd¡ d S )Né   r   ÚMatMulé   ÚAddé   ÚSoftmax)ÚassertEqualÚlenÚnodeÚop_type)Úselfr   © r   úJ/home/ubuntu/.local/lib/python3.10/site-packages/onnx/test/printer_test.pyÚcheck_graph   s   zTestBasicFunctions.check_graphc                 C  sF   d}t  |¡}t |¡}t  |¡}t |¡}|  ||¡ |  |¡ d S )NzÐ
           agraph (float[N, 128] X, float[128,10] W, float[10] B) => (float[N] C)
           {
              T = MatMul(X, W)
              S = Add(T, B)
              C = Softmax(S)
           }
           )r   Úparse_graphr   Úto_textr   r   )r   Útext0Úgraph1Útext1Úgraph2Útext2r   r   r   Útest_parse_graph   s   



z#TestBasicFunctions.test_parse_graphN)r   r   r   r	   )r   r	   )Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s    
r   Ú__main__)
Ú
__future__r   ÚunittestÚonnxr   r   ÚTestCaser   r    Úmainr   r   r   r   Ú<module>   s   ÿ