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

[OTHER]: Array Stubgen #808

Open
finnBsch opened this issue Dec 4, 2024 · 0 comments
Open

[OTHER]: Array Stubgen #808

finnBsch opened this issue Dec 4, 2024 · 0 comments

Comments

@finnBsch
Copy link

finnBsch commented Dec 4, 2024

Hi,

Thanks for the amazing work! In my project, I am returning arrays (e.g. on cuda/pytorch), defined like this

template<typename T>
using GPU3DArray = nb::ndarray<nb::pytorch, T, nb::shape<-1, -1, -1>, nb::c_contig, nb::device::cuda>;

from C++ to python. The generated stubs look like this:

Annotated[ArrayLike, dict(dtype='float32', shape=(None, None, None), order='C', device='cuda', writable=False)]

This does not allow my IDE to understand that it will be a pytorch array and thus it cannot type hint pytorch function for this return value. Is there any way to change this?

According to the documentation, it should already do this, but it doesn't for me. I am using nanobind 2.2.0.

Thanks!

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

1 participant