Skip to content

Is *_contig checked when passing ndarrays? #385

Closed Answered by wjakob
jmalkin asked this question in Q&A
Discussion options

You must be logged in to vote

The ndarray annotations are only used at the Python <-> CPP boundary. Relying on this for function overload resolution and/or implicit conversions within C++ is not an anticipated use case. It is not surprising to me that it is not behaving as expected in your example.

It might be quite hard to support this since ndarray intentionally forgets about what framework created the ndarray following type casting/implicit conversions and the eventual creation of the wrapper around a DLPack tensor. If you need further implicit conversions later on, there is no infrastructure to do so. (The tensor might, e.g., live on the GPU, but nanobind does not link to any GPU frameworks to facilitate copying/r…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jmalkin
Comment options

You must be logged in to vote
0 replies
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