Skip to content

How to use .cast() with a signature of a function? #927

Answered by oremanj
rmoyard asked this question in Q&A
Discussion options

You must be logged in to vote

ndarray::cast() returns an instance of nb::detail::ndarray_object<Args...>, not nb::ndarray<Args...>. They are not interconvertible; ndarray_object wraps a Python object while ndarray doesn't necessarily. It is probably ideal to write your function with an auto return type in order to avoid needing to name this internal type.

Replies: 1 comment 1 reply

Comment options

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

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