
    bIg
                    X    d dl mZ d dlZd dlZd dlmZ d dlmZ dd	dZ	 G d de      Z
y)
    )annotationsN)Base)expectc                    t        j                  | |d      }t        j                  | |z
        }t        j                  ||d      }| |z
  t        j                  |      z
  S )NT)axiskeepdims)npmaxexpsumlog)xr   x_maxtmpss        c/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/backend/test/case/node/logsoftmax.py
logsoftmaxr      sO    FF14$/E
&&U
C
s-AI""    c                  0    e Zd Zedd       Zedd       Zy)
LogSoftmaxc                     t         j                  j                  ddgdg      } t        j                  g dg      j                  t        j                        }t        |      }t        | |g|gd       y )Nr   r   yinputsoutputs)r      test_logsoftmax_example_1r   r   name)	onnxhelper	make_noder	   arrayastypefloat32r   r   )noder   r   s      r   exportzLogSoftmax.export   sg    {{$$5E % 

 HHj\"))"**5 qMtQC!3NOr   c                    t        j                  g dg dg      j                  t         j                        } t	        |       }t
        j                  j                  ddgdg      }t        || g|gd       t        j                  t         j                  j                  d	d
d      j                  t         j                              } t
        j                  j                  ddgdgd      }t	        | d      }t        || g|gd       t
        j                  j                  ddgdgd      }t	        | d      }t        || g|gd       t
        j                  j                  ddgdgd      }t	        | d      }t        || g|gd       t
        j                  j                  ddgdgd      }t	        | d      }t        || g|gd       t
        j                  j                  ddgdg      }t        || g|gd       y )N)r   r         )i'  i'  i'  i'  r   r   r   r   test_logsoftmax_large_numberr   r+         r   )r   r   r   )r   test_logsoftmax_axis_0r   test_logsoftmax_axis_1r*   test_logsoftmax_axis_2r   test_logsoftmax_negative_axistest_logsoftmax_default_axis)r	   r$   r%   r&   r   r!   r"   r#   r   absrandomrandn)r   r   r'   s      r   export_logsoftmax_axisz!LogSoftmax.export_logsoftmax_axis"   s   HHl$@ABII"**U qM{{$$5E % 

 	tQC!3QRFF299??1a+222::>?{{$$5E	 % 
 qq!tQC!3KL{{$$5E	 % 
 qq!tQC!3KL{{$$5E	 % 
 qq!tQC!3KL{{$$5E	 % 
 qr"tQC!3RS {{$$5E % 

 	tQC!3QRr   N)returnNone)__name__
__module____qualname__staticmethodr(   r7    r   r   r   r      s,    
P 
P 9S 9Sr   r   )r   )r   
np.ndarrayr   intr8   r?   )
__future__r   numpyr	   r!   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r   r>   r   r   <module>rE      s+    #   , .#HS HSr   