Reputation: 11
Nanobind has a function nb::ndarray_check(handle h)
which returns true
in case h
is usable as an ndarray (e.g. if it implements the buffer protocol).
How do I actually create an instance of nb::ndarray
from h
?
nb::ndarray
has a constructor explicit ndarray(detail::ndarray_handle *handle)
. But there seems to be none which takes a simple PyObject*
, nb::handle
, or nb::object
as an argument.
Upvotes: 1
Views: 180