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

Function ggml_compute_forward_sgn_f32

ggml.c:8634–8656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8632// ggml_compute_forward_sgn
8633
8634static void ggml_compute_forward_sgn_f32(
8635 const struct ggml_compute_params * params,
8636 const struct ggml_tensor * src0,
8637 struct ggml_tensor * dst) {
8638 assert(params->ith == 0);
8639 assert(ggml_are_same_shape(src0, dst));
8640
8641 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
8642 return;
8643 }
8644
8645 const int n = ggml_nrows(src0);
8646 const int nc = src0->ne[0];
8647
8648 assert(dst->nb[0] == sizeof(float));
8649 assert(src0->nb[0] == sizeof(float));
8650
8651 for (int i = 0; i < n; i++) {
8652 ggml_vec_sgn_f32(nc,
8653 (float *) ((char *) dst->data + i*( dst->nb[1])),
8654 (float *) ((char *) src0->data + i*(src0->nb[1])));
8655 }
8656}
8657
8658static void ggml_compute_forward_sgn(
8659 const struct ggml_compute_params * params,

Callers 1

ggml_compute_forward_sgnFunction · 0.85

Calls 3

ggml_are_same_shapeFunction · 0.70
ggml_nrowsFunction · 0.70
ggml_vec_sgn_f32Function · 0.70

Tested by

no test coverage detected