rotta_rs 0.0.5

a Deep Learning library with rust language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::rotta_rs_module::Tensor;

pub struct MAE {}

impl MAE {
    pub fn init() -> Self {
        Self {}
    }

    pub fn forward(&self, prediction: &Tensor, label: &Tensor) -> Tensor {
        // 1/n sum(abs(label - prediction))
        (1.0 / (prediction.len() as f64)) * &(label - prediction).abs().sum()
    }
}