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

Function ggml_reshape_1d

ggml.c:4504–4526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4502}
4503
4504struct ggml_tensor * ggml_reshape_1d(
4505 struct ggml_context * ctx,
4506 struct ggml_tensor * a,
4507 int64_t ne0) {
4508 GGML_ASSERT(ggml_is_contiguous(a));
4509 GGML_ASSERT(ggml_nelements(a) == ne0);
4510
4511 bool is_node = false;
4512
4513 if (a->grad) {
4514 is_node = true;
4515 }
4516
4517 const int64_t ne[1] = { ne0 };
4518 struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, 1, ne, a, 0);
4519 ggml_format_name(result, "%s (reshaped)", a->name);
4520
4521 result->op = GGML_OP_RESHAPE;
4522 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
4523 result->src[0] = a;
4524
4525 return result;
4526}
4527
4528struct ggml_tensor * ggml_reshape_2d(
4529 struct ggml_context * ctx,

Callers 4

forwardFunction · 0.50
forward_loraFunction · 0.50
llama_build_train_graphsFunction · 0.50

Calls 5

ggml_is_contiguousFunction · 0.70
ggml_nelementsFunction · 0.70
ggml_new_tensor_implFunction · 0.70
ggml_format_nameFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected