ggml
ggml copied to clipboard
re-introduce `n_dims` field?
n_dims field is now deleted from ggml_tensor, and ggml_n_dims() can be used to get it.
Now, if we create a single column matrix (n_dims = 2, shape = n x 1), ggml_n_dims() == 1 which is just the same as a vector.
Maybe n_dims can be re-introduced?
If ne[0] == 1 and ne[1] == 2 (i.e. a single-column matrix), ggml_n_dims() will return 2 which is correct.
Oh, my fault.
I mean ggml_new_tensor_2d(..., 2, 1), then ggml_n_dims() == 1.
Yes, this is correct, but I don't think it will cause any problems. Is there a specific problem that you run into because of this?
When loading a single-row matrix, n_dims mismatching occurs:
https://github.com/foldl/chatllm.cpp/blob/247be09f8247c972d5f77d6263a2d173b8dfab8d/chat.cpp#L394C11-L398C12
Special treatment is needed for single-row matrices, or generally, tensors with the last ne[]-s are 1.