Skip to content

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

Fix zero dimension subgraph compilation crash (#39794)

Chenhu Wang9c12496baf97
diff --git a/src/core/reference/src/op/tile.cpp b/src/core/reference/src/op/tile.cpp
index 325d4382162..1c900ccb431 100644
--- a/src/core/reference/src/op/tile.cpp
+++ b/src/core/reference/src/op/tile.cpp
@@ -4,11 +4,8 @@
#include "openvino/reference/tile.hpp"
-#include <algorithm>
#include <cstdio>
-#include "openvino/core/except.hpp"
-
namespace ov {
namespace reference {
@@ -28,11 +25,8 @@ void tile(const char* arg,
const Shape& out_shape,
const size_t elem_size,
const std::vector<int64_t>& repeats) {
- if (std::any_of(repeats.begin(), repeats.end(), [](int64_t repeat) {
- return repeat <= 0;
- })) {
- OPENVINO_ASSERT(shape_size(out_shape) == 0,
- "Tile with non-positive repeats must produce an empty output shape.");
+ // Nothing to copy when the inferred output is empty.
+ if (shape_size(out_shape) == 0) {
return;
}
diff --git a/src/plugins/template/tests/functional/op_reference/tile.cpp b/src/plugins/template/tests/functional/op_reference/tile.cpp
index 08ea6cb259e..a36078113e8 100644
--- a/src/plugins/template/tests/functional/op_reference/tile.cpp
+++ b/src/plugins/template/tests/functional/op_reference/tile.cpp
@@ -110,6 +110,14 @@ std::vector<TileParams> generateParams() {
reference_tests::Tensor(ET_INT, {3}, std::vector<T_INT>{2, 0, 3}),
reference_tests::Tensor(ET, {2, 0, 9}, std::vector<T>{}),
"tile_1d_to_3d_with_zero_on_axis_1"),
+ TileParams(reference_tests::Tensor(ET, {0, 1}, std::vector<T>{}),
+ reference_tests::Tensor(ET_INT, {2}, std::vector<T_INT>{1, 3}),
+ reference_tests::Tensor(ET, {0, 3}, std::vector<T>{}),
+ "tile_zero_input_dimension_ticket"),
+ TileParams(reference_tests::Tensor(ET, {2, 3, 0}, std::vector<T>{}),
+ reference_tests::Tensor(ET_INT, {3}, std::vector<T_INT>{2, 3, 4}),
+ reference_tests::Tensor(ET, {4, 9, 0}, std::vector<T>{}),
+ "tile_zero_input_dimension_inner_axis"),
};
return params;
}