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

Function ggml_add1_impl

ggml.c:3272–3294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3270// ggml_add1
3271
3272static 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
3296struct ggml_tensor * ggml_add1(
3297 struct ggml_context * ctx,

Callers 3

ggml_add1Function · 0.70
ggml_add1_inplaceFunction · 0.70
ggml_add1_or_setFunction · 0.70

Calls 4

ggml_is_scalarFunction · 0.70
ggml_is_padded_1dFunction · 0.70
ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected