MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ggml_compute_forward_get_rows_f32

Function ggml_compute_forward_get_rows_f32

ggml.c:10375–10400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10373}
10374
10375static void ggml_compute_forward_get_rows_f32(
10376 const struct ggml_compute_params * params,
10377 const struct ggml_tensor * src0,
10378 const struct ggml_tensor * src1,
10379 struct ggml_tensor * dst) {
10380 assert(params->ith == 0);
10381
10382 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
10383 return;
10384 }
10385
10386 const int nc = src0->ne[0];
10387 const int nr = ggml_nelements(src1);
10388
10389 assert( dst->ne[0] == nc);
10390 assert( dst->ne[1] == nr);
10391 assert(src0->nb[0] == sizeof(float));
10392
10393 for (int i = 0; i < nr; ++i) {
10394 const int r = ((int32_t *) src1->data)[i];
10395
10396 ggml_vec_cpy_f32(nc,
10397 (float *) ((char *) dst->data + i*dst->nb[1]),
10398 (float *) ((char *) src0->data + r*src0->nb[1]));
10399 }
10400}
10401
10402static void ggml_compute_forward_get_rows(
10403 const struct ggml_compute_params * params,

Callers 1

Calls 2

ggml_nelementsFunction · 0.70
ggml_vec_cpy_f32Function · 0.70

Tested by

no test coverage detected