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

Function ggml_repeat_back

ggml.c:3710–3733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3708// ggml_repeat_back
3709
3710struct ggml_tensor * ggml_repeat_back(
3711 struct ggml_context * ctx,
3712 struct ggml_tensor * a,
3713 struct ggml_tensor * b) {
3714 GGML_ASSERT(ggml_can_repeat(b, a));
3715
3716 bool is_node = false;
3717
3718 if (a->grad) {
3719 is_node = true;
3720 }
3721
3722 if (ggml_are_same_shape(a, b) && !is_node) {
3723 return a;
3724 }
3725
3726 struct ggml_tensor * result = ggml_new_tensor(ctx, a->type, b->n_dims, b->ne);
3727
3728 result->op = GGML_OP_REPEAT_BACK;
3729 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3730 result->src[0] = a;
3731
3732 return result;
3733}
3734
3735// ggml_concat
3736

Callers 2

ggml_compute_backwardFunction · 0.70
mainFunction · 0.50

Calls 4

ggml_can_repeatFunction · 0.70
ggml_are_same_shapeFunction · 0.70
ggml_new_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 1

mainFunction · 0.40