
    |/hi                         d dl ZddZy)    Nc                    t        j                  |       }|%t        d t        |j                        D              }|t        |      z  }|t        j                  t        j                  ||      |      z
  }t        j                  |      }t        j                  t        j                  ||      |      }||z  }t        | j                        dk(  r|j                         }|S )a  
    Compute the softmax of each element along an axis of X.

    Parameters
    ----------
    X: ND-Array. Probably should be floats.
    theta (optional): float parameter, used as a multiplier
        prior to exponentiation. Default = 1.0
    axis (optional): axis to compute values along. Default is the
        first non-singleton axis.

    Returns an array the same size as X. The result will sum to 1
    along the specified axis.
    c              3   8   K   | ]  }|d    d kD  s|d     yw)   r   N ).0js     D/server/volume/plugins/@scrypted/onnx/zip/unzipped/common/softmax.py	<genexpr>zsoftmax.<locals>.<genexpr>   s     AQ!qAaDAs   
)axisr   )np
atleast_2dnext	enumerateshapefloatexpand_dimsmaxexpsumlenflatten)Xthetar   yax_sumps         r	   softmaxr      s    " 	aA |A)AGG"4AA 	
E%LA 	
BNN266!D1488A 	q	A ^^BFF1T2D9F 	
F
A 177|qaiik!H    )g      ?N)numpyr   r   r   r   r	   <module>r       s    )r   