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

Function ggml_reshape_3d

ggml.c:4553–4577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4551}
4552
4553struct ggml_tensor * ggml_reshape_3d(
4554 struct ggml_context * ctx,
4555 struct ggml_tensor * a,
4556 int64_t ne0,
4557 int64_t ne1,
4558 int64_t ne2) {
4559 GGML_ASSERT(ggml_is_contiguous(a));
4560 GGML_ASSERT(ggml_nelements(a) == ne0*ne1*ne2);
4561
4562 bool is_node = false;
4563
4564 if (a->grad) {
4565 is_node = true;
4566 }
4567
4568 const int64_t ne[3] = { ne0, ne1, ne2 };
4569 struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, 3, ne, a, 0);
4570 ggml_format_name(result, "%s (reshaped)", a->name);
4571
4572 result->op = GGML_OP_RESHAPE;
4573 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
4574 result->src[0] = a;
4575
4576 return result;
4577}
4578
4579struct ggml_tensor * ggml_reshape_4d(
4580 struct ggml_context * ctx,

Callers 15

ggml_conv_1dFunction · 0.70
build_llama_variantsMethod · 0.70
build_optMethod · 0.70
build_baichuanMethod · 0.70
build_falconMethod · 0.70
build_starcoderMethod · 0.70
build_refactMethod · 0.70
build_bloomMethod · 0.70
build_mptMethod · 0.70
forwardFunction · 0.50
forward_batchFunction · 0.50
forward_loraFunction · 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