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

Function ggml_compute_forward_abs_f32

ggml.c:8592–8614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8590// ggml_compute_forward_abs
8591
8592static void ggml_compute_forward_abs_f32(
8593 const struct ggml_compute_params * params,
8594 const struct ggml_tensor * src0,
8595 struct ggml_tensor * dst) {
8596 assert(params->ith == 0);
8597 assert(ggml_are_same_shape(src0, dst));
8598
8599 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
8600 return;
8601 }
8602
8603 const int n = ggml_nrows(src0);
8604 const int nc = src0->ne[0];
8605
8606 assert(dst->nb[0] == sizeof(float));
8607 assert(src0->nb[0] == sizeof(float));
8608
8609 for (int i = 0; i < n; i++) {
8610 ggml_vec_abs_f32(nc,
8611 (float *) ((char *) dst->data + i*( dst->nb[1])),
8612 (float *) ((char *) src0->data + i*(src0->nb[1])));
8613 }
8614}
8615
8616static void ggml_compute_forward_abs(
8617 const struct ggml_compute_params * params,

Callers 1

ggml_compute_forward_absFunction · 0.85

Calls 3

ggml_are_same_shapeFunction · 0.70
ggml_nrowsFunction · 0.70
ggml_vec_abs_f32Function · 0.70

Tested by

no test coverage detected