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

Function ggml_compute_forward_tanh_f32

ggml.c:8760–8782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8758// ggml_compute_forward_tanh
8759
8760static void ggml_compute_forward_tanh_f32(
8761 const struct ggml_compute_params * params,
8762 const struct ggml_tensor * src0,
8763 struct ggml_tensor * dst) {
8764 assert(params->ith == 0);
8765 assert(ggml_are_same_shape(src0, dst));
8766
8767 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
8768 return;
8769 }
8770
8771 const int n = ggml_nrows(src0);
8772 const int nc = src0->ne[0];
8773
8774 assert(dst->nb[0] == sizeof(float));
8775 assert(src0->nb[0] == sizeof(float));
8776
8777 for (int i = 0; i < n; i++) {
8778 ggml_vec_tanh_f32(nc,
8779 (float *) ((char *) dst->data + i*( dst->nb[1])),
8780 (float *) ((char *) src0->data + i*(src0->nb[1])));
8781 }
8782}
8783
8784static void ggml_compute_forward_tanh(
8785 const struct ggml_compute_params * params,

Callers 1

Calls 3

ggml_are_same_shapeFunction · 0.70
ggml_nrowsFunction · 0.70
ggml_vec_tanh_f32Function · 0.70

Tested by

no test coverage detected