Skip to content

Ordering of nb::ndarray #486

Closed Answered by wjakob
qnzhou asked this question in Q&A
Mar 19, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

When returning an array, the annotations like f_contig or shape are just decorations to get a nice type annotation. It's your task to give all the relevant info to the nb::ndarray constructor (runtime values) so that the result indeed has these properties. In your case, I think that you need to specify the strides parameter.

It would be an interesting possibility to compute strides automatically if the return value is annotated, but this is not implemented right now. These decorations just play a role on the input end.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@qnzhou
Comment options

Answer selected by qnzhou
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