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

Function ggml_sub_impl

ggml.c:3369–3390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3367// ggml_sub
3368
3369static struct ggml_tensor * ggml_sub_impl(
3370 struct ggml_context * ctx,
3371 struct ggml_tensor * a,
3372 struct ggml_tensor * b,
3373 bool inplace) {
3374 GGML_ASSERT(ggml_are_same_shape(a, b));
3375
3376 bool is_node = false;
3377
3378 if (!inplace && (a->grad || b->grad)) {
3379 is_node = true;
3380 }
3381
3382 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
3383
3384 result->op = GGML_OP_SUB;
3385 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3386 result->src[0] = a;
3387 result->src[1] = b;
3388
3389 return result;
3390}
3391
3392struct ggml_tensor * ggml_sub(
3393 struct ggml_context * ctx,

Callers 3

ggml_subFunction · 0.70
ggml_sub_inplaceFunction · 0.70
ggml_sub_or_setFunction · 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