MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / ggml_reshape

Function ggml_reshape

subprojects/llama.cpp/ggml/src/ggml.c:3515–3530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3513// ggml_reshape
3514
3515struct ggml_tensor * ggml_reshape(
3516 struct ggml_context * ctx,
3517 struct ggml_tensor * a,
3518 struct ggml_tensor * b) {
3519 GGML_ASSERT(ggml_is_contiguous(a));
3520 // as only the shape of b is relevant, and not its memory layout, b is allowed to be non contiguous.
3521 GGML_ASSERT(ggml_nelements(a) == ggml_nelements(b));
3522
3523 struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, GGML_MAX_DIMS, b->ne, a, 0);
3524 ggml_format_name(result, "%s (reshaped)", a->name);
3525
3526 result->op = GGML_OP_RESHAPE;
3527 result->src[0] = a;
3528
3529 return result;
3530}
3531
3532struct ggml_tensor * ggml_reshape_1d(
3533 struct ggml_context * ctx,

Callers 1

ggml_compute_backwardFunction · 0.85

Calls 4

ggml_is_contiguousFunction · 0.85
ggml_nelementsFunction · 0.85
ggml_new_tensor_implFunction · 0.85
ggml_format_nameFunction · 0.85

Tested by

no test coverage detected