| 8842 | // ggml_compute_forward_relu |
| 8843 | |
| 8844 | static 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 | |
| 8868 | static void ggml_compute_forward_relu( |
| 8869 | const struct ggml_compute_params * params, |
no test coverage detected