-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[PyOV] Allow creation of Tensors from pointers #27725
base: master
Are you sure you want to change the base?
Conversation
@@ -37,6 +37,38 @@ void regclass_Tensor(py::module m) { | |||
:type shared_memory: bool | |||
)"); | |||
|
|||
cls.def(py::init([](int64_t data_ptr, const ov::Shape& shape, const ov::element::Type& ov_type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can data_ptr
be a void *
here?
if not, I suggest to use uint64_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same in line
This PR will be closed in a week because of 2 weeks of no activity. |
This PR was closed because it has been stalled for 2 week with no activity. |
Details:
np.array
before passing the data to Tensor constructorsnumpy
only supports CPU memory (more info)np.array
Example usage:
On hold
To be discussed
array
as an argument but a pointer to it, the reference count forarray
is not incremented (see the new test and the one above it). The ctor can't take thearray
as argument and retrieve its pointer in the binding, because it would interfere with other Tensor ctor overloads.tensor_from_ptr()
.data_dispatcher.py
beacuse there already is a dispatch for anint
Tickets: