MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / ggml_conv_1d

Function ggml_conv_1d

subprojects/llama.cpp/ggml/src/ggml.c:4409–4426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4407// ggml_conv_1d
4408
4409struct ggml_tensor * ggml_conv_1d(
4410 struct ggml_context * ctx,
4411 struct ggml_tensor * a,
4412 struct ggml_tensor * b,
4413 int s0,
4414 int p0,
4415 int d0) {
4416 struct ggml_tensor * im2col = ggml_im2col(ctx, a, b, s0, 0, p0, 0, d0, 0, false, GGML_TYPE_F16); // [N, OL, IC * K]
4417
4418 struct ggml_tensor * result =
4419 ggml_mul_mat(ctx,
4420 ggml_reshape_2d(ctx, im2col, im2col->ne[0], (im2col->ne[2] * im2col->ne[1])), // [N, OL, IC * K] => [N*OL, IC * K]
4421 ggml_reshape_2d(ctx, a, (a->ne[0] * a->ne[1]), a->ne[2])); // [OC,IC, K] => [OC, IC * K]
4422
4423 result = ggml_reshape_3d(ctx, result, im2col->ne[1], a->ne[2], im2col->ne[2]); // [N, OC, OL]
4424
4425 return result;
4426}
4427
4428// ggml_conv_1d_ph
4429

Callers 1

ggml_conv_1d_phFunction · 0.85

Calls 4

ggml_im2colFunction · 0.85
ggml_mul_matFunction · 0.85
ggml_reshape_2dFunction · 0.85
ggml_reshape_3dFunction · 0.85

Tested by

no test coverage detected