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

Function ggml_conv_transpose_1d

ggml.c:5302–5338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5300}
5301
5302GGML_API struct ggml_tensor * ggml_conv_transpose_1d(
5303 struct ggml_context * ctx,
5304 struct ggml_tensor * a,
5305 struct ggml_tensor * b,
5306 int s0,
5307 int p0,
5308 int d0) {
5309 GGML_ASSERT(ggml_is_matrix(b));
5310 GGML_ASSERT(a->ne[2] == b->ne[1]);
5311 GGML_ASSERT(a->ne[3] == 1);
5312
5313 GGML_ASSERT(p0 == 0);
5314 GGML_ASSERT(d0 == 1);
5315
5316 bool is_node = false;
5317
5318 if (a->grad || b->grad) {
5319 GGML_ASSERT(false); // TODO: implement backward
5320 is_node = true;
5321 }
5322
5323 const int64_t ne[4] = {
5324 ggml_calc_conv_transpose_1d_output_size(b->ne[0], a->ne[0], s0, 0 /*p0*/, 1 /*d0*/),
5325 a->ne[1], b->ne[2], 1,
5326 };
5327 struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, 4, ne);
5328
5329 int32_t params[] = { s0, p0, d0 };
5330 ggml_set_op_params(result, params, sizeof(params));
5331
5332 result->op = GGML_OP_CONV_TRANSPOSE_1D;
5333 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
5334 result->src[0] = a;
5335 result->src[1] = b;
5336
5337 return result;
5338}
5339
5340// ggml_conv_2d
5341

Callers

nothing calls this directly

Calls 5

ggml_is_matrixFunction · 0.70
ggml_new_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected