From 965597a873090dc10c3b1f215b9a5cf06017a8ba Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Wed, 16 Aug 2023 06:36:27 +0100 Subject: [PATCH] Add a test for qmatmul. (#459) --- candle-core/tests/quantized_tests.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/candle-core/tests/quantized_tests.rs b/candle-core/tests/quantized_tests.rs index 8b4ddcd9..2c05abb4 100644 --- a/candle-core/tests/quantized_tests.rs +++ b/candle-core/tests/quantized_tests.rs @@ -29,5 +29,18 @@ fn quantized_matmul() -> Result<()> { [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::()?, + &[ + [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(()) }