Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-introduce n_dims field? #704

Open
foldl opened this issue Jan 23, 2024 · 4 comments
Open

re-introduce n_dims field? #704

foldl opened this issue Jan 23, 2024 · 4 comments

Comments

@foldl
Copy link
Contributor

foldl commented Jan 23, 2024

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?

@ggerganov
Copy link
Owner

If ne[0] == 1 and ne[1] == 2 (i.e. a single-column matrix), ggml_n_dims() will return 2 which is correct.

@foldl
Copy link
Contributor Author

foldl commented Jan 23, 2024

Oh, my fault.

I mean ggml_new_tensor_2d(..., 2, 1), then ggml_n_dims() == 1.

@ggerganov
Copy link
Owner

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?

@foldl
Copy link
Contributor Author

foldl commented Jan 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants