| 4474 | } |
| 4475 | |
| 4476 | GGML_API struct ggml_tensor * ggml_conv_transpose_1d( |
| 4477 | struct ggml_context * ctx, |
| 4478 | struct ggml_tensor * a, |
| 4479 | struct ggml_tensor * b, |
| 4480 | int s0, |
| 4481 | int p0, |
| 4482 | int d0) { |
| 4483 | GGML_ASSERT(ggml_is_matrix(b)); |
| 4484 | GGML_ASSERT(a->ne[2] == b->ne[1]); |
| 4485 | GGML_ASSERT(a->ne[3] == 1); |
| 4486 | |
| 4487 | GGML_ASSERT(p0 == 0); |
| 4488 | GGML_ASSERT(d0 == 1); |
| 4489 | |
| 4490 | const int64_t ne[4] = { |
| 4491 | ggml_calc_conv_transpose_1d_output_size(b->ne[0], a->ne[0], s0, 0 /*p0*/, 1 /*d0*/), |
| 4492 | a->ne[1], b->ne[2], 1, |
| 4493 | }; |
| 4494 | struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, 4, ne); |
| 4495 | |
| 4496 | int32_t params[] = { s0, p0, d0 }; |
| 4497 | ggml_set_op_params(result, params, sizeof(params)); |
| 4498 | |
| 4499 | result->op = GGML_OP_CONV_TRANSPOSE_1D; |
| 4500 | result->src[0] = a; |
| 4501 | result->src[1] = b; |
| 4502 | |
| 4503 | return result; |
| 4504 | } |
| 4505 | |
| 4506 | // ggml_conv_2d |
| 4507 | |