U C^@sXddlmZddlZzddlmZWnek r@ddZYnXddZd d d ZdS) )unicode_literalsN)get_array_modulecOstS)N)numpy)akr-/tmp/pip-install-6_kvzl1k/thinc/thinc/loss.pyr srcCsnt|}|j|jdd}d}tt|D]8}d||t||f<|d||t||fd7}q(|||fS)NZfloat32)Zdtypegg?)rzerosshaperangelenint)Zscoreslabelsxptargetlossirrrcategorical_crossentropys"r皙?cCsDt|}|||jdd}||k|}|||||||fS)N)Zaxis)rabssum)Zvec1Zvec2rmarginrdistrrrr L1_distances r)r) __future__rrZcupyr ImportErrorrrrrrrs