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

Function ggml_pool_1d

ggml.c:5480–5509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5478// ggml_pool_1d
5479
5480struct ggml_tensor * ggml_pool_1d(
5481 struct ggml_context * ctx,
5482 struct ggml_tensor * a,
5483 enum ggml_op_pool op,
5484 int k0,
5485 int s0,
5486 int p0) {
5487
5488 bool is_node = false;
5489
5490 if (a->grad) {
5491 GGML_ASSERT(false); // TODO: implement backward
5492 is_node = true;
5493 }
5494
5495 const int64_t ne[3] = {
5496 ggml_calc_pool_output_size(a->ne[0], k0, s0, p0),
5497 a->ne[1],
5498 };
5499 struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, 2, ne);
5500
5501 int32_t params[] = { op, k0, s0, p0 };
5502 ggml_set_op_params(result, params, sizeof(params));
5503
5504 result->op = GGML_OP_POOL_1D;
5505 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
5506 result->src[0] = a;
5507
5508 return result;
5509}
5510
5511// ggml_pool_2d
5512

Callers

nothing calls this directly

Calls 4

ggml_new_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected