()
| 480 | |
| 481 | #[test] |
| 482 | fn test_cpu_backend_adaln_modulate() { |
| 483 | let backend = CpuBackend::new(); |
| 484 | // (batch=1, seq=2, hidden=4) |
| 485 | let x = Tensor::randn(0f32, 1.0, (1, 2, 4), &Device::Cpu).unwrap(); |
| 486 | let norm_weight = Tensor::ones(4, DType::F32, &Device::Cpu).unwrap(); |
| 487 | let scale = Tensor::zeros((1, 2, 4), DType::F32, &Device::Cpu).unwrap(); |
| 488 | let shift = Tensor::zeros((1, 2, 4), DType::F32, &Device::Cpu).unwrap(); |
| 489 | let result = backend |
| 490 | .adaln_modulate(&x, &norm_weight, &scale, &shift, 1e-6) |
| 491 | .unwrap(); |
| 492 | assert_eq!(result.dims(), &[1, 2, 4]); |
| 493 | } |
| 494 | |
| 495 | #[test] |
| 496 | fn test_cpu_backend_rms_norm_gated() { |
nothing calls this directly
no test coverage detected