Average loss values for all samples in the mini-batch It calls Forward() internally. The calling pattern should be [Evaluate|Forward] Backward.
| 50 | /// It calls Forward() internally. The calling pattern should be |
| 51 | /// [Evaluate|Forward] Backward. |
| 52 | float Evaluate(int flag, const Tensor &prediction, const Tensor &target) { |
| 53 | Tensor loss = Forward(flag, prediction, target); |
| 54 | return Sum<float>(loss) / (1.0f * loss.Size()); |
| 55 | } |
| 56 | |
| 57 | /// Compute the gradients of the loss values w.r.t. the prediction. |
| 58 | virtual Tensor Backward() = 0; |