BendMlAutograd.ce_loss: def of bend-ml-autograd@0.1.1.0 Import: import bend-ml-autograd@0.1.1.0/main.bend as BendMlAutograd Lines 287-289 of bend-ml-autograd@0.1.1.0/main.bend: https://jend.leeeet.dev/read.txt?path=bend-ml-autograd@0.1.1.0/main.bend&start_line=287&end_line=289 import Base import bend-ml-tensor@0.1.0.0/main.bend as T # mean cross-entropy loss: -(1/n) Σ log p[i][label_i] def ce_loss(+n: Nat, +c: Nat, logits: T.Mat, labels: List<&2, Nat>) -> F32: ce_loss2(n, c, c, F32.from_nat(n), T.Mat.softmax(n, c, logits), labels) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.from_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=bend-ml-autograd@0.1.1.0/main.bend&name=ce_loss2 https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor@0.1.2.0/main.bend&name=Mat https://jend.leeeet.dev/definition.txt?path=bend-ml-tensor@0.1.2.0/main.bend&name=Mat.softmax