Skip to content

How to slice a ggml tensor ? #10442

Answered by marty1885
Jianhua-Cui asked this question in Q&A
Nov 21, 2024 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

What you are looking for is ggml_view_*. For the specific example x = x[:, 1:, :] should equivalent to the following (note that GGML stores the shape (ne) and strides (nb) in reverse order.

x = ggml_view_3d(ctx. x, x->ne[0], x->ne[1] - 1, x->ne[3], x->nb[1], x->nb[2], x->nb[1]);

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Jianhua-Cui
Comment options

@Jianhua-Cui
Comment options

@Jianhua-Cui
Comment options

@marty1885
Comment options

@Jianhua-Cui
Comment options

Answer selected by Jianhua-Cui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants