-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[Good First Issue][PyOV]: Support slice and negative indexes for PartialShape and Shape #21968
Comments
i can try this |
Awesome, let us know if you have any questions either here or on Discord. :) |
@jiwaszki should negative indexes be supported on C++ level as well ? |
@ilya-lavrenov a really good question. This makes a lot of sense from Python perspective but is it common practice in C++? It can be quite handy, so I am leaning into adding them to C++ as well. Although the effort of adding it to C++ should be separate (to not overdo this GFI) and later impls can be switched/influence each other. Just a note: slices do not need to be supported -- if anything should mimic them in C++ that would be ranges. Let's move the discussion outside this GFI. @praasz FYI, to be in the loop as Core related topic. |
Oh, it seems the issue has been resolved. @jiwaszki the negative idx , |
@sanbuphy it's resolved only on C++ side, while Python implementation is not finished |
I am reserving this task for @imperixxl on GSoC for Project 7. @p-wysocki can you assign him? Seems like I can't do it by hand for some reason. (@sanbuphy gave me permission to unpin her from task, thank you!) |
.take |
Thank you for looking into this issue! Please let us know if you have any questions or require any help. |
Hi, I wanted some help regarding the building of environment. I started with the normal windows build (did it twice) but it didn't work, so I removed everything and started fresh with Ubuntu 22. The issue is in the code and not the build, I am building everything correctly and the commands work as well but the Python environment is where I face issues; and the dependency issues of course. I've read stack overflow posts and old discussions in the repository but I couldn't fix it at all. As for the actual issue, I navigated through the openvino folders on github itself to locate openvino/src/bindings/python/src/pyopenvino/graph to find the class definitions of Shape/PartialShape; which further contain the getitem function that I have to edit. Any help would be appreciated, thanks |
Hi, I was wondering if someone is going to help or reply. Please unassign the task if you're not going to help. Thanks |
@imperixxl I can't reproduce this issue. For reference, I am working on ubuntu22.04, building on commit from Feb 29 (45ce9e7) with preferred way of creating wheels and installing them into environment. Here are results of following instructions: Can you share any reports from "examples of the few errors"? I cannot deduce what are the issues and possible fixes from descriptions only. If you have issues with building, please consider opening issue for OpenVINO. It may be that some edge-cases are broken or unsupported. If the build stage takes too long, consider what can be removed for it, i.e. add to cmake build command |
@jiwaszki The build doesn't throw any errors, it gets completed without any errors (except some copyright warnings which I suppose can be ignored). For the build command, I am currently using
|
@imperixxl can you share the result of running |
@imperixxl I think you have mismatching versions of OpenVINO itself between repository and what's in your PATH/PYTHONPATH/pip. You try to run tests for opset14 which is not present in 2023.3 release of OV (ref: https://github.com/openvinotoolkit/openvino/tree/2023.3.0/src/bindings/python/src/openvino/runtime). Please clean it up and try again. (PS I really recommend using wheels produced by build, it makes managing easier) |
Thank you for your time @jiwaszki |
@imperixxl if you get the latest main branch there will be some changes between it and predownloaded package 2024.0 (you can check it with |
Due to inactivity, I am self-assigning it. Awaiting another contributor @LucaTamSapienza to be assigned here. |
.take |
Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue. |
Hi @jiwaszki , from openvino import Shape, PartialShape
a = [1, 2, 3]
s = Shape(a)
assert a[-1] == s[-1]
assert a[0:2] == list(s[0:2]) #casting
ps = PartialShape(a)
assert a[-2] == ps[-2]
assert a[1:2] == list(ps[1:2]) #casting My question is whether my interpretation is correct or if I might want to obtain a correct output when comparing Shape/PartialShape and list objects. |
@LucaTamSapienza Good observation but do you know the reason for it? What is the type returned from slicing operation? Why casting should appear? |
@jiwaszki |
@LucaTamSapienza please link PR here. So how would you approach this issue? I think that #22316 targets the issue mentioned by you. |
Normally I would change the eq function to handle different objects for Shape and PS. Since someone is already working on something similar in this PR, I would leave the test with the explicit casting, and after this PR is merged, I would delete it.
Sure @jiwaszki , sorry for the late reply. |
…#23725) ### Details: - Edited and overloaded the __getitem__ operation for `Shape` and `PartialShape` - Added tests for correct the implementation ### Tickets: - 75641 - #21968 --------- Co-authored-by: Jan Iwaszkiewicz <[email protected]> Co-authored-by: Przemyslaw Wysocki <[email protected]>
…openvinotoolkit#23725) ### Details: - Edited and overloaded the __getitem__ operation for `Shape` and `PartialShape` - Added tests for correct the implementation ### Tickets: - 75641 - openvinotoolkit#21968 --------- Co-authored-by: Jan Iwaszkiewicz <[email protected]> Co-authored-by: Przemyslaw Wysocki <[email protected]>
…openvinotoolkit#23725) ### Details: - Edited and overloaded the __getitem__ operation for `Shape` and `PartialShape` - Added tests for correct the implementation ### Tickets: - 75641 - openvinotoolkit#21968 --------- Co-authored-by: Jan Iwaszkiewicz <[email protected]> Co-authored-by: Przemyslaw Wysocki <[email protected]>
Context
This change will align the behavior of container-like OpenVINO structure to feel more pythonic.
What needs to be done?
__getitem__
forPartialShape
andShape
classes to behave like Python lists.Example code that should be passing:
Example Pull Requests
N/A
Resources
Contact points
@jiwaszki @akuporos @p-wysocki
Ticket
75641
The text was updated successfully, but these errors were encountered: