Skip to content

gguf : add tensor shape accessors#24405

Open
QuintinShaw wants to merge 1 commit into
ggml-org:masterfrom
QuintinShaw:openasr/gguf-tensor-dims
Open

gguf : add tensor shape accessors#24405
QuintinShaw wants to merge 1 commit into
ggml-org:masterfrom
QuintinShaw:openasr/gguf-tensor-dims

Conversation

@QuintinShaw

@QuintinShaw QuintinShaw commented Jun 10, 2026

Copy link
Copy Markdown

Overview

This adds two small GGUF accessors for tensor shapes:

  • gguf_get_tensor_n_dims()
  • gguf_get_tensor_dim()

The GGUF API already exposes tensor name, type, offset and byte size. This makes the tensor rank and dimensions available through the public API as well, so tools can inspect GGUF metadata without parsing tensor headers themselves or relying on internal structures.

I also extended tests/test-gguf.cpp to check these accessors against the existing handcrafted tensor metadata cases.

Tested:

cmake --build build --target test-gguf -j 8
ctest --test-dir build -R '^test-gguf$' --output-on-failure

Requirements

@github-actions github-actions Bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant