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

Function ggml_acc_impl

ggml.c:3312–3343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3310// ggml_acc
3311
3312static 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
3345struct ggml_tensor * ggml_acc(
3346 struct ggml_context * ctx,

Callers 4

ggml_accFunction · 0.70
ggml_acc_inplaceFunction · 0.70
ggml_acc_or_setFunction · 0.70
ggml_compute_backwardFunction · 0.70

Calls 5

ggml_nelementsFunction · 0.70
ggml_is_contiguousFunction · 0.70
ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70
ggml_set_op_paramsFunction · 0.70

Tested by

no test coverage detected