MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / batch_quantize

Function batch_quantize

nodedb-vector/src/quantize/sq8.rs:330–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

328
329 #[test]
330 fn batch_quantize() {
331 let vecs = make_vectors();
332 let refs: Vec<&[f32]> = vecs.iter().map(|v| v.as_slice()).collect();
333 let codec = Sq8Codec::calibrate(&refs, 3);
334
335 let batch = codec.quantize_batch(&refs);
336 assert_eq!(batch.len(), 3 * 100);
337
338 // First vector should match individual quantize.
339 let single = codec.quantize(&vecs[0]);
340 assert_eq!(&batch[0..3], &single[..]);
341 }
342
343 #[test]
344 fn constant_dimension_handled() {

Callers

nothing calls this directly

Calls 6

collectMethod · 0.80
quantize_batchMethod · 0.80
quantizeMethod · 0.80
make_vectorsFunction · 0.70
iterMethod · 0.45
as_sliceMethod · 0.45

Tested by

no test coverage detected