Skip to content

Commit

Permalink
fix approx test
Browse files Browse the repository at this point in the history
  • Loading branch information
kali committed Jan 23, 2024
1 parent 548dc25 commit 1c6f130
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions core/src/ops/nn/softmax/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ mod test {
fn check(&self) -> Result<()> {
let inputs = tvec!(self.data.clone().into_tvalue());
let quant_output_dt = Some(self.output_dt).filter(|dt| !dt.is_float());
let softmax = Softmax { axes: self.axes.clone(), quant_output_dt };
let softmax =
Softmax { axes: self.axes.clone(), quant_output_dt, ..Softmax::default() };

// Compute quantized output
let result = softmax.eval(inputs)?;
Expand All @@ -375,7 +376,7 @@ mod test {
// Compute reference output
let input_float = self.data.cast_to::<f32>()?;
let inputs_float = tvec!(input_float.into_owned().into_tvalue());
let softmax_float = Softmax { axes: self.axes.clone(), quant_output_dt: None };
let softmax_float = Softmax { axes: self.axes.clone(), ..Softmax::default() };
let reference_float = softmax_float.eval(inputs_float)?;
let reference_array = args_1!(reference_float);
let reference = reference_array.to_array_view::<f32>()?;
Expand Down
2 changes: 1 addition & 1 deletion linalg/src/generic/softmax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ proptest::proptest! {
#[test]
fn t_xnnpack(x in -100f32..0.) {
use tract_data::internal::{tensor0, Approximation};
tensor0(xnnpack_loop2_exp(x)).close_enough(&tensor0(x.exp()), Approximation::Approximate).unwrap();
tensor0(xnnpack_loop2_exp(x)).close_enough(&tensor0(x.exp()), Approximation::SuperApproximate).unwrap();
}
}

Expand Down

0 comments on commit 1c6f130

Please sign in to comment.