B e]@sXddlmZddlZyddlmZWnek r@ddZYnXddZd d d ZdS) )unicode_literalsN)get_array_modulecOstS)N)numpy)akr-/tmp/pip-install-b8evvk6i/thinc/thinc/loss.pyr srcCsrt|}|j|jdd}d}xHtt|D]8}d||t||f<|d||t||fd7}q*W|||fS)NZfloat32)Zdtypegg?)rzerosshaperangelenint)Zscoreslabelsxptargetlossirrrcategorical_crossentropys$r皙?cCsDt|}|||jdd}||k|}|||||||fS)N)Zaxis)rabssum)Zvec1Zvec2rmarginrdistrrrr L1_distances r)r) __future__rrZcupyr ImportErrorrrrrrrs