openvino icon indicating copy to clipboard operation
openvino copied to clipboard

Unit Testing for MyTensor Object Creation in OpenVINO

Open Saharshjain78 opened this issue 1 year ago • 9 comments

Pull Request Description

This pull request introduces the ability to directly compare PartialShape and Shape objects with lists and tuples. This enhancement simplifies the process of comparing shapes and dimensions in OpenVINO.

Changes

Shape Class

  • Added equality operators in the Shape class to support comparison with std::list<size_t> and std::tuple<size_t>. This allows for direct comparison of a Shape object with a list or tuple of dimensions.

  • Implemented the operator[] and at() methods in the Shape class to support accessing elements by index. The index is normalized to handle negative indices, similar to Python's indexing.

  • Overloaded the << operator for ov::Shape to support printing Shape objects.

PartialShape Class

  • Added equality operators in the PartialShape class to support comparison with std::list<Dimension::value_type> and std::tuple<Dimension::value_type>. This allows for direct comparison of a PartialShape object with a list or tuple of dimensions.

  • Implemented the operator== method in ov::PartialShape to support comparison of two PartialShape objects.

Unit Tests

  • Added unit tests for the creation, value retrieval, shape checking, and dtype checking of MyTensor objects.

These changes aim to improve the usability of the OpenVINO library by simplifying the comparison of shapes and dimensions.

Saharshjain78 avatar Jun 20 '24 00:06 Saharshjain78