Beispiel #1
0
        protected override FloatTensor Forward(FloatTensor prediction, FloatTensor target)
        {
            // Note: prediction should be logits, basically pre-softmax. This method applies softmax first.
            // TODO check shapes

            FloatTensor softmax = Functional.Softmax(prediction);
            FloatTensor output  = ((target.Mul(softmax.Log1p())).Sum()).Mul(-1);

            return(output);
        }