Skip to content

Commit d50006e

Browse files
committed
llama-graph: replace ggml_repeat_4d with ggml_repeat + ggml_new_tensor_4d
The ggml_repeat_4d function doesn't exist in the current ggml API. Replace it with the correct approach using ggml_new_tensor_4d to create a target tensor with the desired shape, then use ggml_repeat to repeat the input tensor to match that shape. This fixes compilation errors when building against system-provided ggml libraries that don't include this non-existent function.
1 parent 745aa53 commit d50006e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/llama-graph.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,8 @@ ggml_tensor * llm_graph_context::build_moe_ffn(
770770

771771
if (weight_before_ffn) {
772772
// repeat cur to [n_embd, n_expert_used, n_tokens]
773-
ggml_tensor * repeated = ggml_repeat_4d(ctx0, cur, n_embd, n_expert_used, n_tokens, 1);
773+
ggml_tensor * target_shape = ggml_new_tensor_4d(ctx0, cur->type, n_embd, n_expert_used, n_tokens, 1);
774+
ggml_tensor * repeated = ggml_repeat(ctx0, cur, target_shape);
774775
cur = ggml_mul(ctx0, repeated, weights);
775776
cb(cur, "ffn_moe_weighted", il);
776777
}

0 commit comments

Comments
 (0)