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

Function ggml_sqr_impl

ggml.c:3498–3515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3496// ggml_sqr
3497
3498static struct ggml_tensor * ggml_sqr_impl(
3499 struct ggml_context * ctx,
3500 struct ggml_tensor * a,
3501 bool inplace) {
3502 bool is_node = false;
3503
3504 if (!inplace && (a->grad)) {
3505 is_node = true;
3506 }
3507
3508 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
3509
3510 result->op = GGML_OP_SQR;
3511 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3512 result->src[0] = a;
3513
3514 return result;
3515}
3516
3517struct ggml_tensor * ggml_sqr(
3518 struct ggml_context * ctx,

Callers 2

ggml_sqrFunction · 0.70
ggml_sqr_inplaceFunction · 0.70

Calls 2

ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected