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

Function ggml_compute_forward_relu_f32

ggml.c:8844–8866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8842// ggml_compute_forward_relu
8843
8844static void ggml_compute_forward_relu_f32(
8845 const struct ggml_compute_params * params,
8846 const struct ggml_tensor * src0,
8847 struct ggml_tensor * dst) {
8848 assert(params->ith == 0);
8849 assert(ggml_are_same_shape(src0, dst));
8850
8851 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
8852 return;
8853 }
8854
8855 const int n = ggml_nrows(src0);
8856 const int nc = src0->ne[0];
8857
8858 assert(dst->nb[0] == sizeof(float));
8859 assert(src0->nb[0] == sizeof(float));
8860
8861 for (int i = 0; i < n; i++) {
8862 ggml_vec_relu_f32(nc,
8863 (float *) ((char *) dst->data + i*( dst->nb[1])),
8864 (float *) ((char *) src0->data + i*(src0->nb[1])));
8865 }
8866}
8867
8868static void ggml_compute_forward_relu(
8869 const struct ggml_compute_params * params,

Callers 1

Calls 3

ggml_are_same_shapeFunction · 0.70
ggml_nrowsFunction · 0.70
ggml_vec_relu_f32Function · 0.70

Tested by

no test coverage detected