| 3685 | // ggml_repeat |
| 3686 | |
| 3687 | struct ggml_tensor * ggml_repeat( |
| 3688 | struct ggml_context * ctx, |
| 3689 | struct ggml_tensor * a, |
| 3690 | struct ggml_tensor * b) { |
| 3691 | GGML_ASSERT(ggml_can_repeat(a, b)); |
| 3692 | |
| 3693 | bool is_node = false; |
| 3694 | |
| 3695 | if (a->grad) { |
| 3696 | is_node = true; |
| 3697 | } |
| 3698 | |
| 3699 | struct ggml_tensor * result = ggml_new_tensor(ctx, a->type, b->n_dims, b->ne); |
| 3700 | |
| 3701 | result->op = GGML_OP_REPEAT; |
| 3702 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 3703 | result->src[0] = a; |
| 3704 | |
| 3705 | return result; |
| 3706 | } |
| 3707 | |
| 3708 | // ggml_repeat_back |
| 3709 | |