MCPcopy Create free account
hub / github.com/evilsocket/cake / test_cpu_backend_stable_softplus

Function test_cpu_backend_stable_softplus

cake-core/src/backends/cpu/mod.rs:353–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 1

stable_softplusMethod · 0.45

Tested by

no test coverage detected