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

Function ggml_conv_1d

ggml.c:5266–5283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5264}
5265
5266GGML_API struct ggml_tensor * ggml_conv_1d(
5267 struct ggml_context * ctx,
5268 struct ggml_tensor * a,
5269 struct ggml_tensor * b,
5270 int s0,
5271 int p0,
5272 int d0) {
5273 struct ggml_tensor * im2col = ggml_im2col(ctx, a, b, s0, 0, p0, 0, d0, 0, false); // [N, OL, IC * K]
5274
5275 struct ggml_tensor * result =
5276 ggml_mul_mat(ctx,
5277 ggml_reshape_2d(ctx, im2col, im2col->ne[0], (im2col->ne[2] * im2col->ne[1])), // [N, OL, IC * K] => [N*OL, IC * K]
5278 ggml_reshape_2d(ctx, a, (a->ne[0] * a->ne[1]), a->ne[2])); // [OC,IC, K] => [OC, IC * K]
5279
5280 result = ggml_reshape_3d(ctx, result, im2col->ne[1], a->ne[2], im2col->ne[2]); // [N, OC, OL]
5281
5282 return result;
5283}
5284
5285// ggml_conv_1d_ph
5286

Callers 1

ggml_conv_1d_phFunction · 0.70

Calls 4

ggml_im2colFunction · 0.70
ggml_mul_matFunction · 0.70
ggml_reshape_2dFunction · 0.70
ggml_reshape_3dFunction · 0.70

Tested by

no test coverage detected