o
     ¢i&  ã                   @   sb   d dl Z d dlZd dlmZmZmZ d dlmZmZ ej	j
e ddej	 ddg¡dd	„ ƒƒZdS )
é    N)ÚPyTorchWrapper_v2ÚTorchScriptWrapper_v1Úpytorch_to_torchscript_wrapper)Ú	has_torchÚtorchzneeds PyTorch)ÚreasonznN,nI,nO)é   é   é   c           
      C   s„   t tj ||¡ƒ ¡ }t|ƒ}tj | |¡ 	d¡}| 
|¡}| 
|¡}tj ||¡ | ¡ }tƒ }	|	 |¡ tj ||	 
|¡¡ d S )NÚf)r   r   ÚnnÚLinearÚ
initializer   ÚnumpyÚrandomÚrandnÚastypeÚpredictÚtestingÚassert_allcloseÚto_bytesr   Ú
from_bytes)
ÚnNÚnIÚnOÚmodelÚscript_modelÚXÚYÚY_scriptÚ
serializedÚscript_model2© r"   ú^/home/ubuntu/.local/lib/python3.10/site-packages/thinc/tests/layers/test_torchscriptwrapper.pyÚtest_pytorch_script   s   


r$   )r   ÚpytestÚ	thinc.apir   r   r   Úthinc.compatr   r   ÚmarkÚskipifÚparametrizer$   r"   r"   r"   r#   Ú<module>   s    