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

Function ggml_compute_forward_map_unary_f32

ggml.c:13431–13453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13429// ggml_compute_forward_map_unary
13430
13431static void ggml_compute_forward_map_unary_f32(
13432 const struct ggml_compute_params * params,
13433 const struct ggml_tensor * src0,
13434 struct ggml_tensor * dst,
13435 const ggml_unary_op_f32_t fun) {
13436 GGML_ASSERT(ggml_are_same_shape(src0, dst));
13437
13438 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
13439 return;
13440 }
13441
13442 const int n = ggml_nrows(src0);
13443 const int nc = src0->ne[0];
13444
13445 assert( dst->nb[0] == sizeof(float));
13446 assert(src0->nb[0] == sizeof(float));
13447
13448 for (int i = 0; i < n; i++) {
13449 fun(nc,
13450 (float *) ((char *) dst->data + i*( dst->nb[1])),
13451 (float *) ((char *) src0->data + i*(src0->nb[1])));
13452 }
13453}
13454
13455static void ggml_compute_forward_map_unary(
13456 const struct ggml_compute_params * params,

Callers 1

Calls 2

ggml_are_same_shapeFunction · 0.70
ggml_nrowsFunction · 0.70

Tested by

no test coverage detected