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

Function ggml_view_impl

ggml.c:4606–4629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4604}
4605
4606static struct ggml_tensor * ggml_view_impl(
4607 struct ggml_context * ctx,
4608 struct ggml_tensor * a,
4609 int n_dims,
4610 const int64_t * ne,
4611 size_t offset) {
4612
4613 bool is_node = false;
4614
4615 if (a->grad) {
4616 is_node = true;
4617 }
4618
4619 struct ggml_tensor * result = ggml_new_tensor_impl(ctx, a->type, n_dims, ne, a, offset);
4620 ggml_format_name(result, "%s (view)", a->name);
4621
4622 ggml_set_op_params(result, &offset, sizeof(offset));
4623
4624 result->op = GGML_OP_VIEW;
4625 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
4626 result->src[0] = a;
4627
4628 return result;
4629}
4630
4631// ggml_view_1d
4632

Callers 4

ggml_view_1dFunction · 0.70
ggml_view_2dFunction · 0.70
ggml_view_3dFunction · 0.70
ggml_view_4dFunction · 0.70

Calls 4

ggml_new_tensor_implFunction · 0.70
ggml_format_nameFunction · 0.70
ggml_set_op_paramsFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by

no test coverage detected