Comptue the metric value averaged over all samples (in a batch)
| 49 | |
| 50 | /// Comptue the metric value averaged over all samples (in a batch) |
| 51 | float Evaluate(const Tensor& prediction, const Tensor& target) { |
| 52 | const Tensor metric = Forward(prediction, target); |
| 53 | return Sum<float>(metric) / (1.0f * metric.Size()); |
| 54 | } |
| 55 | }; |
| 56 | /// Compute the accuray of the prediction, which is matched against the |
| 57 | /// ground truth labels. |