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

Function ggml_compute_forward_argmax_f32

ggml.c:8294–8320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8292// ggml_compute_forward_argmax
8293
8294static void ggml_compute_forward_argmax_f32(
8295 const struct ggml_compute_params * params,
8296 const struct ggml_tensor * src0,
8297 struct ggml_tensor * dst) {
8298 assert(params->ith == 0);
8299
8300 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
8301 return;
8302 }
8303
8304 assert(src0->nb[0] == sizeof(float));
8305 assert(dst->nb[0] == sizeof(float));
8306
8307 const int64_t ne00 = src0->ne[0];
8308 const int64_t ne01 = src0->ne[1];
8309
8310 const size_t nb01 = src0->nb[1];
8311 const size_t nb0 = dst->nb[0];
8312
8313 for (int64_t i1 = 0; i1 < ne01; i1++) {
8314 float * src = (float *) ((char *) src0->data + i1*nb01);
8315 int32_t * dst_ = (int32_t *) ((char *) dst->data + i1*nb0);
8316 int v = 0;
8317 ggml_vec_argmax_f32(ne00, &v, src);
8318 dst_[0] = v;
8319 }
8320}
8321
8322static void ggml_compute_forward_argmax(
8323 const struct ggml_compute_params * params,

Callers 1

Calls 1

ggml_vec_argmax_f32Function · 0.70

Tested by

no test coverage detected