Add a test for qmatmul. (#459)

This commit is contained in:
Laurent Mazare
2023-08-16 06:36:27 +01:00
committed by GitHub
parent ca449f9ee1
commit 965597a873

View File

@ -29,5 +29,18 @@ fn quantized_matmul() -> Result<()> {
[343392.0, 996704.0, 1650016.0, 2303328.0] [343392.0, 996704.0, 1650016.0, 2303328.0]
] ]
); );
let qtensor = quantized::QTensor::new(rhs_t, (64, 4));
let op = quantized::QMatMul::new(std::sync::Arc::new(qtensor));
let res = tensor_lhs.custom_op1(op)?;
assert_eq!(
res.to_vec2::<f32>()?,
&[
[85120.43, 214561.61, 345454.9, 474748.1],
[213474.94, 604465.25, 1000686.4, 1388317.3],
[341875.88, 994283.0, 1655708.8, 2301518.3]
]
);
Ok(()) Ok(())
} }