diff --git a/src/bindings/python/src/pyopenvino/core/compiled_model.cpp b/src/bindings/python/src/pyopenvino/core/compiled_model.cpp index e17bfb2ecb0022..d7bc71a4ed5aa0 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& (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& (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& (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.