diff --git a/src/core/data/matrix.rs b/src/core/data/matrix.rs index da114ba..f50ffd7 100644 --- a/src/core/data/matrix.rs +++ b/src/core/data/matrix.rs @@ -227,6 +227,13 @@ impl ops::Div<&Matrix> for Matrix{ } impl Matrix{ + pub fn abs(&mut self) { + for i in 0..self.rows{ + for j in 0..self.columns{ + self.data[i][j] = self.data[i][j].abs(); + } + } + } pub fn clip(&mut self, clip_range: &Range){ for i in 0..self.rows { for j in 0..self.columns { diff --git a/src/core/layer/methods/errors.rs b/src/core/layer/methods/errors.rs index 719414d..6ca816e 100644 --- a/src/core/layer/methods/errors.rs +++ b/src/core/layer/methods/errors.rs @@ -12,7 +12,10 @@ impl ErrorTypes{ ErrorTypes::MeanAbsolute => { let actual_matrix = Matrix::from(actual.to_param_2d()); let expected_matrix = Matrix::from(expected.to_param_2d()); - Box::new((actual_matrix - &expected_matrix).transpose()) + + let res = (actual_matrix - &expected_matrix).transpose(); + + Box::new(res) }, ErrorTypes::MeanSquared => { let actual_matrix = Matrix::from(actual.to_param_2d());