diff --git a/src/bindings/c/docs/api_overview.md b/src/bindings/c/docs/api_overview.md index 6ca2ad403c1a7e..3deedeb5ddef65 100644 --- a/src/bindings/c/docs/api_overview.md +++ b/src/bindings/c/docs/api_overview.md @@ -181,8 +181,14 @@ typedef enum { U1, //!< binary element type + U2, //!< u2 element type + + U3, //!< u3 element type + U4, //!< u4 element type + U6, //!< u6 element type + U8, //!< u8 element type U16, //!< u16 element type @@ -193,6 +199,12 @@ typedef enum { NF4, //!< nf4 element type + F8E4M3, //!< f8e4m3 element type + + F8E5M3, //!< f8e5m2 element type + + STRING, //!< string element type + } ov_element_type_e; ``` diff --git a/src/bindings/c/include/openvino/c/ov_common.h b/src/bindings/c/include/openvino/c/ov_common.h index daebbb7b656587..22ac486fc819cc 100644 --- a/src/bindings/c/include/openvino/c/ov_common.h +++ b/src/bindings/c/include/openvino/c/ov_common.h @@ -165,7 +165,8 @@ typedef enum { /** * @enum ov_element_type_e * @ingroup ov_base_c_api - * @brief This enum contains codes for element type. + * @brief This enum contains codes for element type, which is aligned with ov::element::Type_t in + * src/core/include/openvino/core/type/element_type.hpp */ typedef enum { UNDEFINED = 0U, //!< Undefined element type @@ -181,7 +182,10 @@ typedef enum { I32, //!< i32 element type I64, //!< i64 element type U1, //!< binary element type + U2, //!< u2 element type + U3, //!< u3 element type U4, //!< u4 element type + U6, //!< u6 element type U8, //!< u8 element type U16, //!< u16 element type U32, //!< u32 element type @@ -189,6 +193,7 @@ typedef enum { NF4, //!< nf4 element type F8E4M3, //!< f8e4m3 element type F8E5M3, //!< f8e5m2 element type + STRING, //!< string element type } ov_element_type_e; /** diff --git a/src/bindings/c/src/common.h b/src/bindings/c/src/common.h index cec3e9999c430b..bf41e520cfa8fd 100644 --- a/src/bindings/c/src/common.h +++ b/src/bindings/c/src/common.h @@ -209,5 +209,6 @@ struct mem_istream : virtual mem_stringbuf, std::istream { }; char* str_to_char_array(const std::string& str); +ov_element_type_e find_ov_element_type_e(ov::element::Type type); ov::element::Type get_element_type(ov_element_type_e type); void dup_last_err_msg(const char* msg); diff --git a/src/bindings/c/src/ov_node.cpp b/src/bindings/c/src/ov_node.cpp index b52eda58faa715..5d920a02bed4fc 100644 --- a/src/bindings/c/src/ov_node.cpp +++ b/src/bindings/c/src/ov_node.cpp @@ -87,7 +87,7 @@ ov_status_e ov_port_get_element_type(const ov_output_const_port_t* port, ov_elem try { auto type = (ov::element::Type_t)port->object->get_element_type(); - *tensor_type = (ov_element_type_e)type; + *tensor_type = find_ov_element_type_e(type); } CATCH_OV_EXCEPTIONS diff --git a/src/bindings/c/src/ov_tensor.cpp b/src/bindings/c/src/ov_tensor.cpp index 3ad7d408add000..952f9cb394ba92 100644 --- a/src/bindings/c/src/ov_tensor.cpp +++ b/src/bindings/c/src/ov_tensor.cpp @@ -19,16 +19,20 @@ const std::map element_type_map = { {ov_element_type_e::I32, ov::element::i32}, {ov_element_type_e::I64, ov::element::i64}, {ov_element_type_e::U1, ov::element::u1}, + {ov_element_type_e::U2, ov::element::u2}, + {ov_element_type_e::U3, ov::element::u3}, {ov_element_type_e::U4, ov::element::u4}, + {ov_element_type_e::U6, ov::element::u6}, {ov_element_type_e::U8, ov::element::u8}, {ov_element_type_e::U16, ov::element::u16}, {ov_element_type_e::U32, ov::element::u32}, {ov_element_type_e::U64, ov::element::u64}, {ov_element_type_e::NF4, ov::element::nf4}, {ov_element_type_e::F8E4M3, ov::element::f8e4m3}, - {ov_element_type_e::F8E5M3, ov::element::f8e5m2}}; + {ov_element_type_e::F8E5M3, ov::element::f8e5m2}, + {ov_element_type_e::STRING, ov::element::string}}; -inline ov_element_type_e find_ov_element_type_e(ov::element::Type type) { +ov_element_type_e find_ov_element_type_e(ov::element::Type type) { for (auto iter = element_type_map.begin(); iter != element_type_map.end(); iter++) { if (iter->second == type) { return iter->first;