
    wi                        d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZmZ  G d dej	                  Z
edk    r ej                     dS dS )    )annotationsN)TensorProtohelperc                      e Zd ZddZdS )TestUtilityFunctionsreturnNonec                   d } |d          } |d          } |d          } |d          } |d          } |d          } |d          } |d	          }	t          j        d
ddgdg          }
t          j        dddgdg          }t          j        dddgdg          }t          j        d
ddgdg          }t          j        dddgdg          }t          j        dddgd	g          }t          j        |
|||||gd||g|	g          }t          j        |d          }t	          j                    }t          j                            |d          }t          j
        ||           t          j                            |d          }g d}ddg}t          j                            ||||           t          j        |          }|                     |j        d           |                     |j        |j                   |                     |j        |j                   |                     t%          |j        j                  d           |                     t%          |j        j                  d           |                     t%          |j        j                  d           |                     |j        j        d         |           |                     |j        j        d         |           |                     |j        j        d         |           |                     |j        j        d         |           |                     |j        j        d         |           t/          j        |d           d S )Nc                F    t          j        | t          j        ddg          S )N      )r   make_tensor_value_infor   FLOAT)names    d/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/onnx/test/utils_test.pycreate_tensorz>TestUtilityFunctions.test_extract_model.<locals>.create_tensor   s    0{7H1a&QQQ    A0A1B0B1B2C0C1D0AddSubMultest)producer_namezoriginal.onnxzextracted.onnx)r   r   r   zonnx.utils.extract_modelr      r   r   T)ignore_errors)r   	make_node
make_graph
make_modeltempfilemkdtempospathjoinonnxsaveutilsextract_modelloadassertEqualr    
ir_versionopset_importlengraphnodeinputoutputshutilrmtree)selfr   r   r   r   r   r   r   r   r   L0_0L0_1L0_2L1_0L1_1L2_0g0m0tdirp0p1input_namesoutput_namesm1s                           r   test_extract_modelz'TestUtilityFunctions.test_extract_model   sa   	R 	R 	R ]4  ]4  ]4  ]4  ]4  ]4  ]4  ]4  d|dV<<d|dV<<d|dV<<d|dV<<d|dV<<d|dV<<4tT40&2r(RD
 
 r888!!W\\$00	"bW\\$ 011(((d|
  RlCCCYr]])+EFFF666"/:::RX]++Q///RX^,,a000RX_--q111*B///*B///*B///+R000+R000d$//////r   N)r   r	   )__name__
__module____qualname__rI    r   r   r   r      s(        ,0 ,0 ,0 ,0 ,0 ,0r   r   __main__)
__future__r   r(   r8   r&   unittestr+   r   r   TestCaser   rJ   mainrM   r   r   <module>rS      s    # " " " " " 				     $ $ $ $ $ $ $ $-0 -0 -0 -0 -08, -0 -0 -0` zHMOOOOO r   