| 3270 | // ggml_add1 |
| 3271 | |
| 3272 | static struct ggml_tensor * ggml_add1_impl( |
| 3273 | struct ggml_context * ctx, |
| 3274 | struct ggml_tensor * a, |
| 3275 | struct ggml_tensor * b, |
| 3276 | bool inplace) { |
| 3277 | GGML_ASSERT(ggml_is_scalar(b)); |
| 3278 | GGML_ASSERT(ggml_is_padded_1d(a)); |
| 3279 | |
| 3280 | bool is_node = false; |
| 3281 | |
| 3282 | if (a->grad || b->grad) { |
| 3283 | is_node = true; |
| 3284 | } |
| 3285 | |
| 3286 | struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); |
| 3287 | |
| 3288 | result->op = GGML_OP_ADD1; |
| 3289 | result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; |
| 3290 | result->src[0] = a; |
| 3291 | result->src[1] = b; |
| 3292 | |
| 3293 | return result; |
| 3294 | } |
| 3295 | |
| 3296 | struct ggml_tensor * ggml_add1( |
| 3297 | struct ggml_context * ctx, |
no test coverage detected