Skip to content

Commit

Permalink
Did abs but then abs was not great
Browse files Browse the repository at this point in the history
  • Loading branch information
BradenEverson committed Feb 1, 2024
1 parent 38ab6e6 commit 4d8c675
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/core/data/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<f32>){
for i in 0..self.rows {
for j in 0..self.columns {
Expand Down
5 changes: 4 additions & 1 deletion src/core/layer/methods/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4d8c675

Please sign in to comment.