o
    wi                     @  sf   d dl mZ d dlZd dlZd dlZd dlmZmZmZm	Z	 G dd dej
Zedkr1e  dS dS )    )annotationsN)TensorProtohelpernumpy_helpershape_inferencec                   @  s   e Zd ZdddZdS )TestTrainingToolreturnNonec               
   C  s4  ddg}d}t jj| t j}tj||d}t|t	j
|}ddg}d}t jj| t j}tj||d}	t|t	j
|}
ddg}d}t|t	j
|}tjd||g|gd}t|gd||
g|g||	g}ddg}d	}t jj| t j}tj||d}t|t	j
|}ddg}d
}t|t	j
|}tjd||g|gd}t|gd|g|g|g}t|||fgd d }t|}tj| |j }|| tt|jjt|jd jj dt|jjt|jd jj t|jjt|jd jj t|jjt|jd jj }t|}t|}tj| d S )N   A)nameBCMatMul)inputsoutputssimple_inferenceXYsimple_trainingr   full_training_graph)nprandomrandastypefloat32r   
from_arrayr   make_tensor_value_infor   FLOAT	make_node
make_graphmake_training_info
make_modelonnxcheckercheck_modeltraining_infoaddCopyFromlistgraphnode	algorithminputoutputinitializerr   infer_shapes) selfA_shapeA_namer   A_initializerA_value_infoB_shapeB_namer   B_initializerB_value_infoC_shapeC_nameC_value_infoinference_nodeinference_graphX_shapeX_namer   X_initializerX_value_infoY_shapeY_nameY_value_infor+   training_graphr&   modelnew_training_infor   full_training_modelfull_training_model_with_shapes rK   Y/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/onnx/test/training_tool_test.pytest_training_info_proto   sx   	





z)TestTrainingTool.test_training_info_protoN)r   r	   )__name__
__module____qualname__rM   rK   rK   rK   rL   r      s    r   __main__)
__future__r   unittestnumpyr   r#   r   r   r   r   TestCaser   rN   mainrK   rK   rK   rL   <module>   s   V