MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / test_gemm

Function test_gemm

ciphercore-base/src/evaluators/simple_evaluator.rs:3476–3554  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3474
3475 #[test]
3476 fn test_gemm() {
3477 || -> Result<()> {
3478 gemm_helper(
3479 array_type(vec![2, 3], UINT32),
3480 array_type(vec![3, 3], UINT32),
3481 array!([[1, 2, 3], [4, 5, 6]]).into_raw_vec(),
3482 array!([[7, 8, 9], [10, 11, 12], [13, 14, 15]]).into_raw_vec(),
3483 array!([[50, 68, 86], [122, 167, 212]]).into_raw_vec(),
3484 )?;
3485 gemm_helper(
3486 array_type(vec![2, 2, 2], UINT32),
3487 array_type(vec![2, 3, 2], UINT32),
3488 vec![1, 2, 3, 4, 5, 6, 7, 8],
3489 vec![10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],
3490 vec![
3491 50, 110, 170, 110, 250, 390, 830, 1050, 1270, 1130, 1430, 1730,
3492 ],
3493 )?;
3494
3495 gemm_helper(
3496 array_type(vec![2, 127], BIT),
3497 array_type(vec![3, 127], BIT),
3498 vec![1; 2 * 127],
3499 vec![1; 3 * 127],
3500 vec![1, 1, 1, 1, 1, 1],
3501 )?;
3502
3503 {
3504 let mut arr0 = vec![1; 127];
3505 arr0.extend(vec![0; 127]);
3506
3507 let mut arr1 = vec![1; 127];
3508 arr1.extend(vec![0; 127]);
3509 arr1.extend(vec![1; 127]);
3510
3511 gemm_helper(
3512 array_type(vec![2, 127], BIT),
3513 array_type(vec![3, 127], BIT),
3514 arr0,
3515 arr1,
3516 vec![1, 0, 1, 0, 0, 0],
3517 )?;
3518 }
3519 gemm_helper(
3520 array_type(vec![2, 3], BIT),
3521 array_type(vec![3, 3], BIT),
3522 array!([[1, 0, 1], [0, 1, 1]]).into_raw_vec(),
3523 array!([[1, 1, 1], [0, 1, 0], [1, 1, 0]]).into_raw_vec(),
3524 vec![0, 0, 1, 0, 1, 1],
3525 )?;
3526
3527 gemm_helper(
3528 array_type(vec![2, 9], BIT),
3529 array_type(vec![3, 9], BIT),
3530 array!([[1, 0, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 0, 1, 0]]).into_raw_vec(),
3531 array!([
3532 [1, 0, 1, 0, 1, 0, 1, 0, 1],
3533 [0, 1, 0, 1, 0, 1, 0, 1, 0],

Callers

nothing calls this directly

Calls 4

gemm_helperFunction · 0.85
gemm_helper_randomFunction · 0.85
array_typeFunction · 0.50
extendMethod · 0.45

Tested by

no test coverage detected