U
    q±Ëhí  ã                   @  sR   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rNe 	¡  dS )é    )ÚannotationsN)ÚparserÚprinterc                   @  s*   e Zd Zdddœdd„Zddœdd„Zd	S )
ÚTestBasicFunctionszonnx.GraphProtoÚNone)ÚgraphÚreturnc                 C  sR   |   t|jƒd¡ |   |jd jd¡ |   |jd jd¡ |   |jd jd¡ d S )Né   r   ZMatMulé   ZAddé   ZSoftmax)ÚassertEqualÚlenÚnodeZop_type)Úselfr   © r   ú:/tmp/pip-unpacked-wheel-xnis5xre/onnx/test/printer_test.pyÚcheck_graph   s    zTestBasicFunctions.check_graph)r   c                 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   Zparse_graphr   Zto_textr   r   )r   Ztext0Zgraph1Ztext1Zgraph2Ztext2r   r   r   Útest_parse_graph   s    



z#TestBasicFunctions.test_parse_graphN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s   r   Ú__main__)
Ú
__future__r   ZunittestZonnxr   r   ZTestCaser   r   Úmainr   r   r   r   Ú<module>   s   