OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[py-api] Add `compiled_blob` property to py API (#29614)
Pawel Raasz2c03306a8f87
diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cppindex 31a6473eca2..ba506e9fa7e 100644--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp@@ -100,6 +100,7 @@ void regmodule_properties(py::module m) {wrap_property_RW(m_hint, ov::hint::dynamic_quantization_group_size, "dynamic_quantization_group_size");wrap_property_RW(m_hint, ov::hint::kv_cache_precision, "kv_cache_precision");wrap_property_RW(m_hint, ov::hint::activations_scale_factor, "activations_scale_factor");+ wrap_property_RW(m_hint, ov::hint::compiled_blob, "compiled_blob");// Submodule intel_cpupy::module m_intel_cpu =diff --git a/src/bindings/python/src/pyopenvino/utils/utils.cpp b/src/bindings/python/src/pyopenvino/utils/utils.cppindex ce2f80eea83..0abf4339629 100644--- a/src/bindings/python/src/pyopenvino/utils/utils.cpp+++ b/src/bindings/python/src/pyopenvino/utils/utils.cpp@@ -269,6 +269,8 @@ py::object from_ov_any(const ov::Any& any) {return py::cast(any.as<ov::frontend::type::PyNone>());} else if (any.is<ov::frontend::type::PyScalar>()) {return py::cast(any.as<ov::frontend::type::PyScalar>());+ } else if (any.is<ov::Tensor>()) {+ return py::cast(any.as<ov::Tensor>());} else {PyErr_SetString(PyExc_TypeError, "Failed to convert parameter to Python representation!");return py::cast<py::object>((PyObject*)NULL);diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.pyindex 447e668d3ad..e3c1599b7a3 100644--- a/src/bindings/python/tests/test_runtime/test_properties.py+++ b/src/bindings/python/tests/test_runtime/test_properties.py@@ -474,6 +474,15 @@ def test_properties_rw(ov_property_rw, expected_value, test_values):#### Special cases###+def test_compiled_blob_property():+ assert hints.compiled_blob == "COMPILED_BLOB"+ compiled_blob = hints.compiled_blob(ov.Tensor(Type.u8, [2, 5]))++ assert compiled_blob[0] == "COMPILED_BLOB"+ assert compiled_blob[1].value.element_type == Type.u8+ assert compiled_blob[1].value.shape == [2, 5]++def test_properties_device_priorities():assert device.priorities == "MULTI_DEVICE_PRIORITIES"assert device.priorities("CPU,GPU") == ("MULTI_DEVICE_PRIORITIES", OVAny("CPU,GPU,"))