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
Fix: Prevent dangling reference crash by correcting C++ return value policy. (#32508)
Sungeun Kimd349f15392d8
diff --git a/src/bindings/python/src/pyopenvino/core/compiled_model.cpp b/src/bindings/python/src/pyopenvino/core/compiled_model.cppindex e17bfb2ecb0..d7bc71a4ed5 100644--- a/src/bindings/python/src/pyopenvino/core/compiled_model.cpp+++ b/src/bindings/python/src/pyopenvino/core/compiled_model.cpp@@ -251,6 +251,7 @@ void regclass_CompiledModel(py::module m) {cls.def("output",(const ov::Output<const ov::Node>& (ov::CompiledModel::*)() const) & ov::CompiledModel::output,+ py::return_value_policy::reference_internal,R"(Gets a single output of a compiled model.If the model has more than one output, this method throws an exception.@@ -261,6 +262,7 @@ void regclass_CompiledModel(py::module m) {cls.def("output",(const ov::Output<const ov::Node>& (ov::CompiledModel::*)(size_t) const) & ov::CompiledModel::output,+ py::return_value_policy::reference_internal,py::arg("index"),R"(Gets output of a compiled model identified by an index.@@ -275,6 +277,7 @@ void regclass_CompiledModel(py::module m) {cls.def("output",(const ov::Output<const ov::Node>& (ov::CompiledModel::*)(const std::string&) const) &ov::CompiledModel::output,+ py::return_value_policy::reference_internal,py::arg("tensor_name"),R"(Gets output of a compiled model identified by a tensor_name.