MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / run_pca

Function run_pca

subprojects/llama.cpp/tools/cvector-generator/pca.hpp:296–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296static void run_pca(
297 struct pca_params & params,
298 const std::vector<struct ggml_tensor *> & v_input, // shape of v_input[0]: [n_samples, n_embd]
299 const std::vector<struct ggml_tensor *> & v_output) {
300 printf("%s: Running PCA...\n", __func__);
301 for (size_t il = 0; il < v_input.size(); ++il) {
302
303 // prepare output vector
304 struct ggml_tensor * ctrl_out = v_output[il];
305 ggml_format_name(ctrl_out, "direction.%zu", il+1);
306
307 // run power_iteration
308 params.i_layer = il;
309 params.n_layers = v_input.size();
310 power_iteration(params, v_input[il], ctrl_out);
311 printf("%s: Done layer %d / %d\n", __func__, (int) il+1, (int) v_input.size());
312 }
313}
314
315}

Callers 1

mainFunction · 0.85

Calls 3

ggml_format_nameFunction · 0.85
power_iterationFunction · 0.85
sizeMethod · 0.65

Tested by

no test coverage detected