(a: &Tensor, b: &Tensor, tol: f32)
| 8 | } |
| 9 | |
| 10 | fn assert_close(a: &Tensor, b: &Tensor, tol: f32) { |
| 11 | let diff = (a - b).unwrap().abs().unwrap(); |
| 12 | let max_diff: f32 = diff |
| 13 | .flatten_all() |
| 14 | .unwrap() |
| 15 | .max(0) |
| 16 | .unwrap() |
| 17 | .to_scalar() |
| 18 | .unwrap(); |
| 19 | assert!(max_diff < tol, "max diff {max_diff} exceeds tolerance {tol}"); |
| 20 | } |
| 21 | |
| 22 | // ── linear_forward ───────────────────────────────────────────────────── |
| 23 |
no outgoing calls
no test coverage detected