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

Function test_cpu_backend_attention_causal

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

Source from the content-addressed store, hash-verified

390
391 #[test]
392 fn test_cpu_backend_attention_causal() {
393 let backend = CpuBackend::new();
394 let q = Tensor::randn(0f32, 1.0, (1, 2, 4, 8), &Device::Cpu).unwrap();
395 let k = Tensor::randn(0f32, 1.0, (1, 2, 4, 8), &Device::Cpu).unwrap();
396 let v = Tensor::randn(0f32, 1.0, (1, 2, 4, 8), &Device::Cpu).unwrap();
397 let result = backend.attention(&q, &k, &v, 0.125, true).unwrap();
398 assert_eq!(result.dims(), &[1, 2, 4, 8]);
399 }
400
401 #[test]
402 fn test_cpu_backend_exp_mul() {

Callers

nothing calls this directly

Calls 1

attentionMethod · 0.45

Tested by

no test coverage detected