mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 19:58:35 +00:00
Add a test for qmatmul. (#459)
This commit is contained in:
@ -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::<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(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user