openvino icon indicating copy to clipboard operation
openvino copied to clipboard

Python binding for the `Shape` and `PartialShape` classes added with …

Open EJ-enun opened this issue 1 year ago • 21 comments

…the relevant tests.

Python binding for the Shape or PartialShape classes added with corresponding tests in the OpenVINO library.This allows Python code to create and manipulate instances of the Shape or PartialShape class.

The __eq__ method is a special method in Python that defines the behavior of the equality operator ==. In the original code, this method is not defined for the Shape and PartialShape class, which means that by default, two Shape or PartialShape objects are considered equal if they are the same object. However, it does not allow for comparison with Python native data types like lists and tuples, which is what the new requirement is asking for.

To implement this, I added two new overloads of the __eq__ method. One overload takes a py::tuple as the second argument, and the other takes a py::list. Both methods in each script first check if the size of the Shape or PartialShape object is the same as the size of the tuple or list. If the sizes are not the same, the two objects cannot be equal, so the method returns false. If the sizes are the same, the method then compares each element of the Shape and PartialShape objects with the corresponding element of the tuple or list. If it finds any pair of elements that are not equal, it returns false. If it gets through all the elements without finding any unequal pairs, it returns true.

The test cases are straightforward. They create Shape and PartialShape objects from lists and tuples, and then use the assert statement to check that the Shape and PartialShape objects are equal to the original list or tuple. If the __eq__ method is implemented correctly, these assertions will pass.

Details:

  • item1
  • ...

Tickets:

Closes https://github.com/openvinotoolkit/openvino/issues/21969

EJ-enun avatar Jan 22 '24 13:01 EJ-enun

build_jenkins

p-wysocki avatar Jan 22 '24 15:01 p-wysocki

Hello @EJ-enun,

Thank you for your contribution.

Please, fix codestyle for cpp files and apply changes according to the comments left. The easiest way to fix codestyle is -- configure project like this cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -B build This command will create codestyle diff, just apply it. cmake --build build --target clang_format_fix_all -j8

akuporos avatar Jan 23 '24 10:01 akuporos

build_jenkins

p-wysocki avatar Feb 02 '24 11:02 p-wysocki

This PR will be closed in a week because of 2 weeks of no activity.

github-actions[bot] avatar Feb 20 '24 00:02 github-actions[bot]

hej @EJ-enun, hope you are well :) Will you find a time to address comments and finish PR?

mlukasze avatar Feb 20 '24 06:02 mlukasze

This PR will be closed in a week because of 2 weeks of no activity.

github-actions[bot] avatar Mar 08 '24 00:03 github-actions[bot]

Hi, been swamped with work. Will get on it this weekend.

EJ-enun avatar Mar 08 '24 00:03 EJ-enun

hej @EJ-enun, hope you are well :)

Will you find a time to address comments and finish PR?

Hi, i will devote time to this tomorrow. I've had a torrid 2 weeks.

EJ-enun avatar Mar 08 '24 00:03 EJ-enun

hey @EJ-enun :) will you have time to address Anastasia's requests?

mlukasze avatar Mar 19 '24 09:03 mlukasze

Yes, I will. Which specific concerns perchance?

On Tue, 19 Mar 2024 at 05:02, Michal Lukaszewski @.***> wrote:

hey @EJ-enun https://github.com/EJ-enun :) will you have time to address Anastasia's requests?

— Reply to this email directly, view it on GitHub https://github.com/openvinotoolkit/openvino/pull/22316#issuecomment-2006397936, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIIERSFXBN6VOPTFJEFCGLYY75LDAVCNFSM6AAAAABCFIDINKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGM4TOOJTGY . You are receiving this because you were mentioned.Message ID: @.***>

EJ-enun avatar Mar 19 '24 09:03 EJ-enun

This PR will be closed in a week because of 2 weeks of no activity.

github-actions[bot] avatar Apr 03 '24 00:04 github-actions[bot]

Hi @EJ-enun,

Could you please u[date your PR? Remove excess files like CMakeCache and fix codestyle according to my comments.

Thank you, Anastasia

akuporos avatar Apr 05 '24 11:04 akuporos

Hi @akuporos , I ran the Cmake command and fixed the codestyle for cpp files and applied the other changes according to the comments left. I deleted the Cmake cache quite a while ago, can you please help me check and make sure i am on track? I would like to complete this as I have let it drag on for too long. Thank you, Enun

EJ-enun avatar Apr 08 '24 17:04 EJ-enun

Hi @EJ-enun,

I still see CMakeCache.txt in File Changed. Looks like it was missed. Also I see that my comments weren't applied -- I don't see codestyle changes in the test file.

akuporos avatar Apr 10 '24 08:04 akuporos

Everytime i try to run this script "cmake --build build --target clang_format_fix_all -j8"

I get the ninja: error: unknown target 'clang_format_fix_all' I have checked the CMakeLists.txt file and i cannot find 'clang_format_fix_all' in there. How do i resolve this?

EJ-enun avatar Apr 11 '24 12:04 EJ-enun

HI @EJ-enun,

Have you installed clang-format-9? Did you configured project like this cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT ..?

akuporos avatar Apr 11 '24 17:04 akuporos

cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -B build

I ran this command successfully "cmake -DENABLE_PYTHON=ON -DENABLE_TESTS=ON -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT -B build" but the other command returns that error. And how do I install clang-format-9 outside of this command.

EJ-enun avatar Apr 11 '24 17:04 EJ-enun

@EJ-enun

Please, check this instruction. About clang-format-9 -- it had to be installed before running cmake commands. sudo apt --assume-yes install clang-format-9. But looks like it is installed because otherwise I think you would have problem on the first command.

Actually, for right now you may skip this step with fixing codestyle for .cpp files. Please, remove CMakeCache.txt and apply my comments above (they're fixing codestyle for python files).

akuporos avatar Apr 11 '24 23:04 akuporos

This PR will be closed in a week because of 2 weeks of no activity.

github-actions[bot] avatar Apr 26 '24 00:04 github-actions[bot]

hey @EJ-enun will you find a time to finish this PR?

mlukasze avatar Apr 26 '24 05:04 mlukasze

hey @EJ-enun will you find a time to finish this PR?

Yes i Will.

EJ-enun avatar Apr 29 '24 14:04 EJ-enun

This PR will be closed in a week because of 2 weeks of no activity.

github-actions[bot] avatar May 14 '24 00:05 github-actions[bot]

This PR was closed because it has been stalled for 2 week with no activity.

github-actions[bot] avatar May 21 '24 00:05 github-actions[bot]