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

Function ggml_conv_2d_direct

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

Source from the content-addressed store, hash-verified

4703// ggml_conv_2d_direct
4704
4705struct ggml_tensor * ggml_conv_2d_direct(
4706 struct ggml_context * ctx,
4707 struct ggml_tensor * a, // convolution kernel [KW, KH, IC, OC]
4708 struct ggml_tensor * b, // input data [W, H, C, N]
4709 int s0, // stride dimension 0
4710 int s1, // stride dimension 1
4711 int p0, // padding dimension 0
4712 int p1, // padding dimension 1
4713 int d0, // dilation dimension 0
4714 int d1) {// dilation dimension 1
4715
4716 GGML_ASSERT(a->ne[2] == b->ne[2]);
4717 //GGML_ASSERT(a->type == b->type);
4718
4719 int64_t ne[4];
4720 ne[0] = ggml_calc_conv_output_size(b->ne[0], a->ne[0], s0, p0, d0);
4721 ne[1] = ggml_calc_conv_output_size(b->ne[1], a->ne[1], s1, p1, d1);
4722 ne[2] = a->ne[3];
4723 ne[3] = b->ne[3];
4724
4725 struct ggml_tensor * result = ggml_new_tensor(ctx, b->type, 4, ne);
4726
4727 ggml_set_op_params_i32(result, 0, s0);
4728 ggml_set_op_params_i32(result, 1, s1);
4729 ggml_set_op_params_i32(result, 2, p0);
4730 ggml_set_op_params_i32(result, 3, p1);
4731 ggml_set_op_params_i32(result, 4, d0);
4732 ggml_set_op_params_i32(result, 5, d1);
4733
4734 result->op = GGML_OP_CONV_2D;
4735 result->src[0] = a;
4736 result->src[1] = b;
4737
4738 return result;
4739}
4740
4741// ggml_conv_3d_direct
4742

Callers 6

buildMethod · 0.85
build_edge_residualMethod · 0.85
build_mobilenet_attnMethod · 0.85
buildMethod · 0.85
build_graphMethod · 0.85

Calls 3

ggml_new_tensorFunction · 0.85
ggml_set_op_params_i32Function · 0.85

Tested by 1

build_graphMethod · 0.68