Skip to content

Commit

Permalink
use assert_approx_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
asukaminato0721 committed Dec 16, 2023
1 parent a11df62 commit c8e59b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pre_training.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ fn smooth_and_fill(

#[cfg(test)]
mod tests {
use burn::tensor::Data;

use super::*;
use crate::dataset::split_data;
use crate::training::calculate_average_recall;
Expand All @@ -324,10 +326,8 @@ mod tests {
let init_s0 = 1.0;
let actual = loss(&delta_t, &recall, &count, init_s0, init_s0);
assert_eq!(actual, 13.6243305);
assert_eq!(
format!("{:.4}", loss(&delta_t, &recall, &count, 2.0, init_s0)),
"14.5771"
);
Data::from([loss(&delta_t, &recall, &count, 2.0, init_s0)])
.assert_approx_eq(&Data::from([14.5771]), 5);
}

#[test]
Expand Down

0 comments on commit c8e59b3

Please sign in to comment.