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

Function ggml_div_impl

ggml.c:3455–3480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3453// ggml_div
3454
3455static struct ggml_tensor * ggml_div_impl(
3456 struct ggml_context * ctx,
3457 struct ggml_tensor * a,
3458 struct ggml_tensor * b,
3459 bool inplace) {
3460 GGML_ASSERT(ggml_are_same_shape(a, b));
3461
3462 bool is_node = false;
3463
3464 if (!inplace && (a->grad || b->grad)) {
3465 is_node = true;
3466 }
3467
3468 if (inplace) {
3469 GGML_ASSERT(!is_node);
3470 }
3471
3472 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
3473
3474 result->op = GGML_OP_DIV;
3475 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3476 result->src[0] = a;
3477 result->src[1] = b;
3478
3479 return result;
3480}
3481
3482struct ggml_tensor * ggml_div(
3483 struct ggml_context * ctx,

Callers 2

ggml_divFunction · 0.70
ggml_div_inplaceFunction · 0.70

Calls 3

ggml_are_same_shapeFunction · 0.70
ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected