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

Function ggml_dup_impl

ggml.c:3115–3132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3113// ggml_dup
3114
3115static struct ggml_tensor * ggml_dup_impl(
3116 struct ggml_context * ctx,
3117 struct ggml_tensor * a,
3118 bool inplace) {
3119 bool is_node = false;
3120
3121 if (!inplace && (a->grad)) {
3122 is_node = true;
3123 }
3124
3125 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
3126
3127 result->op = GGML_OP_DUP;
3128 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
3129 result->src[0] = a;
3130
3131 return result;
3132}
3133
3134struct ggml_tensor * ggml_dup(
3135 struct ggml_context * ctx,

Callers 2

ggml_dupFunction · 0.70
ggml_dup_inplaceFunction · 0.70

Calls 2

ggml_view_tensorFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected