a: [OC,IC, KH, KW] b: [N, IC, IH, IW] result: [N, OC, OH, OW]
| 5393 | // b: [N, IC, IH, IW] |
| 5394 | // result: [N, OC, OH, OW] |
| 5395 | struct ggml_tensor * ggml_conv_2d( |
| 5396 | struct ggml_context * ctx, |
| 5397 | struct ggml_tensor * a, |
| 5398 | struct ggml_tensor * b, |
| 5399 | int s0, |
| 5400 | int s1, |
| 5401 | int p0, |
| 5402 | int p1, |
| 5403 | int d0, |
| 5404 | int d1) { |
| 5405 | struct ggml_tensor * im2col = ggml_im2col(ctx, a, b, s0, s1, p0, p1, d0, d1, true); // [N, OH, OW, IC * KH * KW] |
| 5406 | |
| 5407 | struct ggml_tensor * result = |
| 5408 | ggml_mul_mat(ctx, |
| 5409 | ggml_reshape_2d(ctx, im2col, im2col->ne[0], im2col->ne[3] * im2col->ne[2] * im2col->ne[1]), // [N, OH, OW, IC * KH * KW] => [N*OH*OW, IC * KH * KW] |
| 5410 | ggml_reshape_2d(ctx, a, (a->ne[0] * a->ne[1] * a->ne[2]), a->ne[3])); // [OC,IC, KH, KW] => [OC, IC * KH * KW] |
| 5411 | |
| 5412 | result = ggml_reshape_4d(ctx, result, im2col->ne[1], im2col->ne[2], a->ne[3], im2col->ne[3]); // [N, OC, OH, OW] |
| 5413 | |
| 5414 | return result; |
| 5415 | } |
| 5416 | |
| 5417 | // ggml_conv_2d_sk_p0 |
| 5418 | struct ggml_tensor * ggml_conv_2d_sk_p0( |
no test coverage detected