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

Function trained_codec

nodedb-vector/src/rerank/codecs/sq8.rs:154–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152 }
153
154 fn trained_codec() -> Sq8Rerank {
155 let samples: Vec<Vec<f32>> = (0..50).map(|i| make_vec(i as f32 * 0.1)).collect();
156 let refs: Vec<&[f32]> = samples.iter().map(|v| v.as_slice()).collect();
157 let mut codec = Sq8Rerank::new(DIM);
158 codec.train(&refs).expect("train must succeed");
159 codec
160 }
161
162 #[test]
163 fn round_trip_returns_finite_distance() {

Calls 6

make_vecFunction · 0.85
collectMethod · 0.80
iterMethod · 0.45
as_sliceMethod · 0.45
expectMethod · 0.45
trainMethod · 0.45