()
| 351 | |
| 352 | #[test] |
| 353 | fn test_cpu_backend_stable_softplus() { |
| 354 | let backend = CpuBackend::new(); |
| 355 | let x = Tensor::new(&[0.0f32, 1.0, 100.0], &Device::Cpu).unwrap(); |
| 356 | let result = backend.stable_softplus(&x).unwrap(); |
| 357 | assert_eq!(result.dims(), &[3]); |
| 358 | let vals: Vec<f32> = result.to_vec1().unwrap(); |
| 359 | assert!((vals[0] - std::f32::consts::LN_2).abs() < 0.01); |
| 360 | assert!(vals[2] > 99.0); // large x ≈ x |
| 361 | } |
| 362 | |
| 363 | #[test] |
| 364 | fn test_cpu_backend_add3() { |
nothing calls this directly
no test coverage detected