| 3310 | // ggml_acc |
| 3311 | |
| 3312 | static struct ggml_tensor * ggml_acc_impl( |
| 3313 | struct ggml_context * ctx, |
| 3314 | struct ggml_tensor * a, |
| 3315 | struct ggml_tensor * b, |
| 3316 | size_t nb1, |
| 3317 | size_t nb2, |
| 3318 | size_t nb3, |
| 3319 | size_t offset, |
| 3320 | bool inplace) { |
| 3321 | GGML_ASSERT(ggml_nelements(b) <= ggml_nelements(a)); |
| 3322 | GGML_ASSERT(ggml_is_contiguous(a)); |
| 3323 | GGML_ASSERT(a->type == GGML_TYPE_F32); |
| 3324 | GGML_ASSERT(b->type == GGML_TYPE_F32); |
| 3325 | |
| 3326 | bool is_node = false; |
| 3327 | |
| 3328 | if (!inplace && (a->grad || b->grad)) { |
| 3329 | is_node = true; |
| 3330 | } |
| 3331 | |
| 3332 | struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); |
| 3333 | |
| 3334 | int32_t params[] = { nb1, nb2, nb3, offset, inplace ? 1 : 0 }; |
| 3335 | ggml_set_op_params(result, params, sizeof(params)); |
| 3336 | |
| 3337 | result->op = GGML_OP_ACC; |
| 3338 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 3339 | result->src[0] = a; |
| 3340 | result->src[1] = b; |
| 3341 | |
| 3342 | return result; |
| 3343 | } |
| 3344 | |
| 3345 | struct ggml_tensor * ggml_acc( |
| 3346 | struct ggml_context * ctx, |
no test coverage detected