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

Function ggml_compute_forward_get_rows_back_f32

ggml.c:10491–10523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10489}
10490
10491static void ggml_compute_forward_get_rows_back_f32(
10492 const struct ggml_compute_params * params,
10493 const struct ggml_tensor * src0,
10494 const struct ggml_tensor * src1,
10495 struct ggml_tensor * dst) {
10496 GGML_ASSERT(params->ith == 0);
10497 GGML_ASSERT(ggml_is_contiguous(dst));
10498
10499 // ggml_compute_forward_dup_same_cont(params, opt0, dst);
10500
10501 if (params->type == GGML_TASK_INIT) {
10502 memset(dst->data, 0, ggml_nbytes(dst));
10503 }
10504
10505 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
10506 return;
10507 }
10508
10509 const int nc = src0->ne[0];
10510 const int nr = ggml_nelements(src1);
10511
10512 GGML_ASSERT( dst->ne[0] == nc);
10513 GGML_ASSERT(src0->nb[0] == sizeof(float));
10514
10515 for (int i = 0; i < nr; ++i) {
10516 const int r = ((int32_t *) src1->data)[i];
10517
10518 ggml_vec_add_f32(nc,
10519 (float *) ((char *) dst->data + r*dst->nb[1]),
10520 (float *) ((char *) dst->data + r*dst->nb[1]),
10521 (float *) ((char *) src0->data + i*src0->nb[1]));
10522 }
10523}
10524
10525static void ggml_compute_forward_get_rows_back(
10526 const struct ggml_compute_params * params,

Callers 1

Calls 4

ggml_is_contiguousFunction · 0.70
ggml_nbytesFunction · 0.70
ggml_nelementsFunction · 0.70
ggml_vec_add_f32Function · 0.70

Tested by

no test coverage detected