Skip to content

Commit 83de1ad

Browse files
olpipimlukasze
andauthored
Remove usage of deprecated functions (#3011)
Details: Remove usage of deprecated functions from ov::Allocator and ov::Model Tickets: [CVS-174874](https://jira.devtools.intel.com/browse/CVS-174874) [CVS-174873](https://jira.devtools.intel.com/browse/CVS-174873) --------- Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com>
1 parent 82ed84b commit 83de1ad

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

samples/cpp/image_generation/load_image.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ ov::Tensor utils::load_image(const std::filesystem::path& image_path) {
3131
}
3232
throw std::runtime_error{"Unexpected number of bytes was requested to allocate."};
3333
}
34-
void deallocate(void*, size_t bytes, size_t) {
35-
if (channels * height * width != bytes) {
36-
throw std::runtime_error{"Unexpected number of bytes was requested to deallocate."};
37-
}
34+
void deallocate(void*, size_t, size_t) noexcept {
3835
stbi_image_free(image);
3936
image = nullptr;
4037
}

samples/cpp/visual_language_chat/load_image.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ ov::Tensor utils::load_image(const std::filesystem::path& image_path) {
4545
}
4646
throw std::runtime_error{"Unexpected number of bytes was requested to allocate."};
4747
}
48-
void deallocate(void*, size_t bytes, size_t) {
49-
if (channels * height * width != bytes) {
50-
throw std::runtime_error{"Unexpected number of bytes was requested to deallocate."};
51-
}
48+
void deallocate(void*, size_t, size_t) noexcept {
5249
stbi_image_free(image);
5350
image = nullptr;
5451
}

src/python/py_image_generation_pipelines.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,7 @@ class TorchGenerator : public ov::genai::CppStdGenerator {
208208
throw std::runtime_error{"Unexpected number of bytes was requested to allocate."};
209209
}
210210

211-
void deallocate(void*, size_t bytes, size_t) {
212-
if (m_total_size != bytes) {
213-
throw std::runtime_error{"Unexpected number of bytes was requested to deallocate."};
214-
}
211+
void deallocate(void*, size_t, size_t) noexcept {
215212
}
216213

217214
bool is_equal(const TorchTensorAllocator& other) const noexcept {

tests/cpp/helper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ std::shared_ptr<ov::Model> get_dummy_model(ov::Core core, size_t num_layers) {
2626
}
2727
const auto& concat1 = std::make_shared<ov::op::v0::Concat>(keys, 1);
2828
const auto& concat2 = std::make_shared<ov::op::v0::Concat>(values, 1);
29-
auto model = std::make_shared<ov::Model>(ov::NodeVector{concat1, concat2}, params);
30-
return std::make_shared<ov::Model>(ov::NodeVector{concat1, concat2}, params);
29+
return std::make_shared<ov::Model>(ov::OutputVector{concat1, concat2}, params);
3130
}

0 commit comments

Comments
 (0)