Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Adding an OOM message inside the AllocatedTensor constructor (#25711)

Razvan Apetroaiecc921dbb8fa7
diff --git a/src/inference/src/dev/make_tensor.cpp b/src/inference/src/dev/make_tensor.cpp
index 748340e0de5..4fb25dc88c4 100644
--- a/src/inference/src/dev/make_tensor.cpp
+++ b/src/inference/src/dev/make_tensor.cpp
@@ -205,6 +205,8 @@ public:
OPENVINO_ASSERT(allocator, "Allocator was not initialized");
const auto byte_size = element::get_memory_size(element_type, shape_size(shape));
auto data = const_cast<Allocator&>(allocator).allocate(byte_size);
+ OPENVINO_ASSERT(byte_size == 0 || data != nullptr, "Failed to allocate memory");
+
initialize_elements(data, element_type, shape);
return data;
}()},