liblloyal 1.0.0
Composable primitives for llama.cpp inference
Loading...
Searching...
No Matches
lloyal::embedding::detail Namespace Reference

Classes

struct  BatchGuard
 RAII guard for automatic batch cleanup Ensures llama_batch_free is called even if exceptions occur. More...
 

Functions

void apply_l2_normalize (std::vector< float > &vec)
 Apply L2 normalization to embedding vector (in-place)
 

Function Documentation

◆ apply_l2_normalize()

void lloyal::embedding::detail::apply_l2_normalize ( std::vector< float > &  vec)
inline

Apply L2 normalization to embedding vector (in-place)

L2 normalization produces unit vectors required for cosine similarity: cosine_sim(a, b) = dot(normalize(a), normalize(b))

Examples
/home/runner/work/liblloyal/liblloyal/include/lloyal/embedding.hpp.

Definition at line 139 of file embedding.hpp.