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

Function ggml_transpose

ggml.c:4778–4801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4776// ggml_transpose
4777
4778struct ggml_tensor * ggml_transpose(
4779 struct ggml_context * ctx,
4780 struct ggml_tensor * a) {
4781 bool is_node = false;
4782
4783 if (a->grad) {
4784 is_node = true;
4785 }
4786
4787 struct ggml_tensor * result = ggml_view_tensor(ctx, a);
4788 ggml_format_name(result, "%s (transposed)", a->name);
4789
4790 result->ne[0] = a->ne[1];
4791 result->ne[1] = a->ne[0];
4792
4793 result->nb[0] = a->nb[1];
4794 result->nb[1] = a->nb[0];
4795
4796 result->op = GGML_OP_TRANSPOSE;
4797 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
4798 result->src[0] = a;
4799
4800 return result;
4801}
4802
4803// ggml_get_rows
4804

Callers 7

ggml_compute_backwardFunction · 0.70
ggml_graph_importFunction · 0.70
llm_build_kv_storeFunction · 0.70
mainFunction · 0.50
forwardFunction · 0.50
forward_loraFunction · 0.50

Calls 3

ggml_view_tensorFunction · 0.70
ggml_format_nameFunction · 0.70
ggml_dup_tensorFunction · 0.70

Tested by 1

mainFunction · 0.40